| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | # dereference.sh |
| 3 | # Dereferencing parameter passed to a function. |
| 4 | # Script by Bruce W. Clare. |
| 5 | |
| 6 | dereferencescip-shell shell abs-guide 10-4 dereference(). () |
| 7 | { |
| 8 | y=\$"$1" # Name of variable (not value!). |
| 9 | echoscip-shell system . . echo. $y # $Junk |
| 10 | |
| 11 | x=`eval "expr \"$y\" "` |
| 12 | echoscip-shell system . . echo. $1=$x |
| 13 | eval "$1=\"Some Different Text \"" # Assign new value. |
| 14 | } |
| 15 | |
| 16 | Junk="Some Text" |
| 17 | echoscip-shell system . . echo. $Junk "before" # Some Text before |
| 18 | |
| 19 | dereferencescip-shell shell abs-guide 10-4 dereference(). Junk |
| 20 | echoscip-shell system . . echo. $Junk "after" # Some Different Text after |
| 21 | |
| 22 | exit 0 |