Created
May 3, 2016 15:22
-
-
Save SnuktheGreat/9663e76b5217836d9f7c04b0827284c8 to your computer and use it in GitHub Desktop.
Simple caesar cipher bash script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ $# -ne 2 ] || [ $1 -lt -36 ] || [ $1 -gt 35 ] | |
then | |
echo 'Please specify how many random words would you like to generate !' 1>&2 | |
echo 'example: caesar 5 "mjh5i9n 9pio 8jhpn"' 1>&2 | |
echo 'This will do a caesar cipher of 5 places on the given string, returning romanes eunt domus' 1>&2 | |
exit 0 | |
fi | |
nr=$1 | |
if [ $nr -lt 0 ] | |
then | |
nr=$((nr+36)) | |
fi | |
echo $2 | tr $(printf %${nr}s | tr ' ' '.')\0-9a-z 0-9a-z0-9a-z |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment