diff --git a/sh/aur b/sh/aur index 7580182..5053ac5 100755 --- a/sh/aur +++ b/sh/aur @@ -50,7 +50,7 @@ aur() { ### @- # TODO: option to auto install dependencies - local built= + local built= p= for p in "$@"; do cd "$bd" local download_fail=0 @@ -115,6 +115,7 @@ aur() { ### @- fi done + local recent= cd "$bd" if [ -n "$built" ] && [ $o_install -eq 1 ]; then if [ $o_all_at_once -eq 1 ]; then diff --git a/sh/bak b/sh/bak index 5032ee3..bbd0a78 100755 --- a/sh/bak +++ b/sh/bak @@ -20,8 +20,7 @@ bak() { ### @- ### -rw-r--r-- 1 notwa None 0 Dec 25 2001 butts.bak.bak ### ``` [ $# -gt 0 ] || { printf "%s\n" "$0: too few arguments" >&2; return 1; } - local ret=0 - local f= + local ret=0 f= for f; do if [ -e "$f.bak" ]; then bak "$f.bak" || { ret=1; continue; } diff --git a/sh/baknow b/sh/baknow index 6041132..1fbc276 100755 --- a/sh/baknow +++ b/sh/baknow @@ -16,7 +16,7 @@ baknow() { ### @- backup files by appending their timestamps given by [`now`.](# ### -rw-r--r-- 1 notwa None 0 Dec 25 2001 butts.2001-12-26_01800000.bak ### ``` argc $# -ge 1 "$0" || return - local ret=0 + local ret=0 f= for f; do cp -ip "$f" "$f.$(now "$f").bak" || ret=1 done diff --git a/sh/baks b/sh/baks index d2fa794..a10f776 100755 --- a/sh/baks +++ b/sh/baks @@ -19,7 +19,7 @@ baks() { ### @- ### -rw-r--r-- 1 notwa None 0 Dec 25 2001 butts.21-08-01_14-54-07.bak ### -rw-r--r-- 1 notwa None 0 Dec 25 2001 butts.21-08-01_14-54-09.bak ### ``` - local ret=0 + local ret=0 fp= for fp; do local now="$(date -u '+%y-%m-%d_%H-%M-%S')" local bak="$fp.$now.bak" diff --git a/sh/colors2 b/sh/colors2 index 674e70f..dcc15c0 100755 --- a/sh/colors2 +++ b/sh/colors2 @@ -6,6 +6,7 @@ colors2() { [ $# -eq 0 ] || { printf "%s\n" "$0: does not take arguments" >&2; return 1; } + local a= b= i= j= for a in 0 60; do for j in 40 41 43 42 46 44 45 47; do printf ' \033[%s;%sm %03d \033[m' '48;5;16' $((a+j-10)) $((a+j)) diff --git a/sh/compile b/sh/compile index 322549e..0f0da89 100755 --- a/sh/compile +++ b/sh/compile @@ -90,6 +90,8 @@ compile() { ### @- local clang="$(whence -p clang 2>/dev/null)" local clang_flags=() # currently just for clang-msvc + local flag= d= # iterator variables + local cl= vc= if [ -n "$MSYSTEM" ]; then # using msys2? if [ -z "$clang" ]; then # don't have native clang? diff --git a/sh/document b/sh/document index bc18565..3c3d0c1 100755 --- a/sh/document +++ b/sh/document @@ -125,6 +125,7 @@ document1() { # first section: printf '\n## %s\n' 'shell functions' >> "$out" || return 5 + local f= for f in sh/*; do [ -e "$f" ] || continue # make sure glob went through diff --git a/sh/running b/sh/running index 4788215..9eb0e6a 100755 --- a/sh/running +++ b/sh/running @@ -8,7 +8,7 @@ # probably not compatible with busybox ps because its column 2 isn't PID. running() { ### @- WIP - local cmd=0 pid=0 + local cmd=0 pid=0 col= local usage='usage: running {cmd|pid} ...' [ $# -gt 0 ] || { printf '%s\n' "$usage" >&2; return 2; } for col; do diff --git a/sh/sc b/sh/sc index 0c9e7a0..14ea8e2 100755 --- a/sh/sc +++ b/sh/sc @@ -53,7 +53,7 @@ sc() { ### @- return 1 } - local clipboard="" + local clipboard="" f= for f; do f="$(readlink -f "$f")" if [ ! -e "$f" ]; then diff --git a/sh/slit b/sh/slit index c219002..570c482 100755 --- a/sh/slit +++ b/sh/slit @@ -10,6 +10,7 @@ slit() { ### @- ### view specific columns of text. [ $# -gt 0 ] \ || { printf '%s: too few arguments\n' "$0" >&2; return 1; } + local arg= for arg; do [ "$arg" -ge 0 ] 2>/dev/null \ || { printf '%s: not a nonnegative integer: %s\n' "$0" "$arg"; return 1; }; diff --git a/sh/slitt b/sh/slitt index a5ab55a..4d9842c 100755 --- a/sh/slitt +++ b/sh/slitt @@ -11,6 +11,7 @@ slitt() { ### @- ### this version of `slit` uses tabs for its field separators. [ $# -gt 0 ] \ || { printf '%s: too few arguments\n' "$0" >&2; return 1; } + local arg= for arg; do [ "$arg" -ge 0 ] 2>/dev/null \ || { printf '%s: not a nonnegative integer: %s\n' "$0" "$arg"; return 1; }; diff --git a/sh/sum b/sh/sum index cc26777..0790c3a 100755 --- a/sh/sum +++ b/sh/sum @@ -14,7 +14,7 @@ sum() { ### @- ### ``` ### ### **TODO:** consider renaming because sum(1) already exists. - local sum=0 + local sum=0 i= for i; do i="${i%,}" : $((sum+=i)) diff --git a/sh/wat b/sh/wat index a30b797..8ace619 100755 --- a/sh/wat +++ b/sh/wat @@ -11,6 +11,7 @@ wat() { ### @- ### ### written by [leah2.](https://leahneukirchen.org/) ( # constrain unalias + local cmd= for cmd; do if (( $+aliases[$cmd] )); then printf '%s: aliased to %s\n' $cmd $aliases[$cmd]