| 1 | #!/bin/bash |
| 2 | # rot13a.sh: Same as "rot13.sh" script, but writes output to "secure" file. |
| 3 | |
| 4 | # Usage: ./rot13a.sh filename |
| 5 | # or ./rot13a.sh <filename |
| 6 | # or ./rot13a.sh and supply keyboard input (stdin) |
| 7 | |
| 8 | umask 177 # File creation mask. |
| 9 | # Files created by this script |
| 10 | #+ will have 600 permissions. |
| 11 | |
| 12 | OUTFILE=decrypted.txt # Results output to file "decrypted.txt" |
| 13 | #+ which can only be read/written |
| 14 | # by invoker of script (or root). |
| 15 | |
| 16 | cat "$@" | tr 'a-zA-Z' 'n-za-mN-ZA-M' > $OUTFILE |
| 17 | # ^^ Input from stdin or a file. ^^^^^^^^^^ Output redirected to file. |
| 18 | |
| 19 | exit 0 |