Last active
August 14, 2019 08:54
-
-
Save Jcpetrucci/ebd764f2be9b78ea3ee1 to your computer and use it in GitHub Desktop.
Tries all variations of Rot# (i.e. Rot13...Rot14...RotN)
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/bash | |
charset=abcdefghijklmnopqrstuvwxyz # Tweak $charset as needed for your alphabet | |
input=${1,,} #strtolower; greatly simplifies conversion | |
for char in $(seq 1 ${#charset}); do # Count characters in charset, and for each... | |
temp=${charset#?} # Strip the first character, save rest to $temp | |
charset=${temp}${charset%"$temp"} # Move the first character of charset behind the rest (abcde becomes bcdea) | |
echo $input | tr a-z $charset | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment