On Sun, Jan 02, 2011 at 02:27:19PM -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?

because 

  a=65  
  for i in {1..$a}
  do
    echo $i
  done

produces
  1..65

because of the order of evoluation - {1..$a} is evaluated BEFORE $a is
evaluated...

A more portable way would be using the "seq" command:
  a=65
  for i in `seq 1 $a`
  do
    echo $i
  done


hope this helps
-- 
Karl E. Jorgensen
IT Operations Manager


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20110102232220.ga...@hawking.jorgensen.org.uk

Reply via email to