variable in loop

Smoot Carl-Mitchell smoot at tic.com
Sun Jan 2 23:16:53 UTC 2011


On Sun, 2011-01-02 at 14:27 -0800, S Mathias wrote:
> ASDF=hello; a=0; a=$(( 70 - $(echo $ASDF | awk '{print length}') ));
> echo "$a $ASDF"$(for i in {1..$a}; do printf "."; done)

The brace expansion {1..$a} occurs before variable expansion.  The
result you get for the value of the range is {1..65} which is not what
you expect.
-- 
Smoot Carl-Mitchell
System/Network Architect
voice: +1 480 922-7313
cell: +1 602 421-9005
smoot at tic.com





More information about the ubuntu-users mailing list