diff options
| author | DrNuget <drnuget@outlook.com> | 2025-11-13 07:11:42 +0200 |
|---|---|---|
| committer | DrNuget <drnuget@outlook.com> | 2025-11-13 07:11:42 +0200 |
| commit | 85f1a86a95f5639dee1c615fe3d51e0821cb124a (patch) | |
| tree | 095f68fb3a34ac0ead941f391d5dd3d1224522a7 | |
| parent | 048a45fd11b8499eafff65c0a1dde9117f0dd892 (diff) | |
| download | scripts-85f1a86a95f5639dee1c615fe3d51e0821cb124a.tar.gz | |
ROT remove bashisms
| -rwxr-xr-x | scripts/rot | 11 |
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]; } |
