| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | # A version of "rot13" using 'eval'. |
| 3 | # Compare to "rot13.sh" example. |
| 4 | |
| 5 | setvar_rot_13scip-shell shell abs-guide 10-4 setvar_rot_13().() # "rot13" scrambling |
| 6 | { |
| 7 | local varname=$1 varvalue=$2 |
| 8 | eval $varname='$(echo "$varvalue" | tr a-z n-za-m)' |
| 9 | } |
| 10 | |
| 11 | |
| 12 | setvar_rot_13scip-shell shell abs-guide 10-4 setvar_rot_13(). var "foobar" # Run "foobar" through rot13. |
| 13 | echoscip-shell system . . echo. $var # sbbone |
| 14 | |
| 15 | setvar_rot_13scip-shell shell abs-guide 10-4 setvar_rot_13(). var "$var" # Run "sbbone" through rot13. |
| 16 | # Back to original variable. |
| 17 | echoscip-shell system . . echo. $var # foobar |
| 18 | |
| 19 | # This example by Stephane Chazelas. |
| 20 | # Modified by document author. |
| 21 | |
| 22 | exit 0 |