(bourne)shell variable names containing a variable?
Emanuel Strobl
Emanuel.strobl at gmx.net
Thu Oct 20 06:17:38 PDT 2005
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=yes"
instead of assigning yes to one_present....
What am I missing????
Thanks a lot,
-Harry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20051020/4e5c2cdb/attachment.bin
More information about the freebsd-questions
mailing list