On Tue, Aug 16, 2011 at 02:11:43PM -0700, Linda Walsh wrote: > 2) His knowledge base about bash seems to be dated or lacking. > His page on indirect assignment skips using arith expressions and skipped > one line assignments for assigning to indirect vars using the "<<<"
It's a wiki, you know. It can be, and has been, edited by others. You could update it yourself. I very rarely reject any contributions from others. If something doesn't work, I'll usually at least attempt to fix it up rather than reverting it. > but he totally doesn't talk about > > b=0 > > a=b > > (($a=32) > > echo $b > 32 imadev:~$ a=b imadev:~$ (($a=string)) bash: ((: number1 number2 number3 number4: syntax error in expression (error token is "number2 number3 number4") "Oops!" Your trick is limited to numbers. And not even real numbers, either: imadev:~$ (($a=2.3)) bash: ((: b=2.3: syntax error: invalid arithmetic operator (error token is ".3") Just integers. > >>>>[1]prefix="snapdir/@GMT-" > >>>>[2]snap_today="$(date +%Y.%m.%d-)" > >>>>[3]snap_prefix="$mp/$prefix$snap_today*" > >>>>[4]today_snaps="$('ls' -1 ${snap_prefix} 2>/dev/null |tr "\n" " " )" Don't store lists in a string. Store them in an array. ... snapglob="$mp/$prefix$snap_today*" today_snaps=($snapglob) Make sure "set -f" is not in effect, obviously.