aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/rot11
1 files changed, 6 insertions, 5 deletions
diff --git a/scripts/rot b/scripts/rot
index 001cace..fed5c67 100755
--- a/scripts/rot
+++ b/scripts/rot
@@ -3,7 +3,7 @@
# Written by: DrNuget
# License: GNU GPL v2.0
-while [[ $# -gt 0 ]]; do
+while [ $# -gt 0 ]; do
case $1 in
-n)
ROT="$2"
@@ -19,13 +19,14 @@ done
[ -z "$ROT" ] && { ROT="13"; }
-echo "$DATA" | awk -vrot=$ROT -valph=$(echo -n {A..Z} , {a..z} | tr -d ' ') '
+echo "$DATA" | awk -vrot=$ROT '
BEGIN {
- split(alph, alph_arr, ",");
+ alph[1]="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ alph[2]="abcdefghijklmnopqrstuvwxyz"
for (j=1;j<=2;j++) {
- cipher=substr(alph_arr[j], rot+1) substr(alph_arr[j], 1, rot);
+ cipher=substr(alph[j], rot+1) substr(alph[j], 1, rot);
for (i=0;i<26;i++) {
- split(alph_arr[j], chars, "");
+ split(alph[j], chars, "");
split(cipher, cipher_chars, "");
cipher_map[chars[i]]=cipher_chars[i];
}