(bourne)shell variable names containing a variable?

Malcolm Kay malcolm.kay at internode.on.net
Thu Oct 20 07:03:53 PDT 2005


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


More information about the freebsd-questions mailing list