Re: variable in loop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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)
> 65 hello.
> $ 
> 
> 
> Why doesn't it print:
> 65 hello.................................................................
> 
> 
> 
> What am i missing?

The expression {1..$a} is being quoted and treated as a string, instead
of being evaluated. If you change the printf from:

	printf "."

...to:

	printf "[$i]"

...you'll see what's happening.

-Chris

-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux