Debian Codegraph @

rot14.sh

raw symbols SCIP
1 #!/bin/bash
2 # A version of "rot13" using 'eval'.
3 # Compare to "rot13.sh" example.
4
5 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_13 var "foobar" # Run "foobar" through rot13.
13 echo $var # sbbone
14
15 setvar_rot_13 var "$var" # Run "sbbone" through rot13.
16 # Back to original variable.
17 echo $var # foobar
18
19 # This example by Stephane Chazelas.
20 # Modified by document author.
21
22 exit 0