$VAR you get the value of the variable
named VAR. You pass the variable by value. But you
can also pass by reference. Use the exclamation point ! inside
the variable. Here is an example scriptlet that prints the value
of the given variable name:
#!/bin/bash
variable="$1"
echo the value of $variable is ${!variable}
Note with arrays it's different and involves the usage of eval.
| Pete's Linux Advent Calendar 2007 | Comments? send mail to pkruse@arcor.de |
|