Re: (bourne)shell variable names containing a variable?

2005-10-20 Thread Malcolm Kay
On Thu, 20 Oct 2005 10:47 pm, Emanuel Strobl wrote: > #!/bin/sh > list="one two three four" > > for item in $list; do >   ${item}_present=yes eval ${item}_present=yes > done echo $one_present echo $two_present echo $three_present echo $four_present ==> yes yes yes yes Malcolm Kay _

(bourne)shell variable names containing a variable?

2005-10-20 Thread Emanuel Strobl
Hello, I try to assign a value to a variable, but the variable should consist of another variable. Is this possible (in bourne shell)? Example: #!/bin/sh list="one two three four" for item in $list; do ${item}_present=yes done This doesn't work since the shell tries to execute "one_present=