From d6300c4578d9444f8d698a1eb42a46f428e08743 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Sun, 1 Aug 2021 19:34:45 -0700 Subject: [PATCH] make rot13 its own function, document --- home/-shrc | 1 - sh/rot13 | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 sh/rot13 diff --git a/home/-shrc b/home/-shrc index 48edd38..28a4d5d 100644 --- a/home/-shrc +++ b/home/-shrc @@ -173,7 +173,6 @@ alias sortip="sort -t . -k 1,1n -k 2,2n -k 3,3n -k 4,4n" ### @- sort numerically alias jrep='grep -aPo "[\x{20}-\x{7E}\x{4E00}-\x{9FFF}\x{3040}-\x{30FF}]+"' ### @- extract strings comprised of basic ASCII or Japanese codepoints. alias bomb='uconv -f utf-8 -t utf-8 --add-signature' ### @- add a Byte-Order Mark to a file. alias cleanse='tr -cd "\11\12\15\40-\176"' ### @- strip unprintable and non-ASCII characters. -alias rot13='tr "A-Za-z0-9" "N-ZA-Mn-za-m5-90-4"' ### @- rot13 with numbers rotated as well. alias unwrap='awk '\''BEGIN{RS="\n\n";FS="\n"}{for(i=1;i<=NF;i++)printf "%s ",$i;print "\n"}'\' ### @- join paragraphs into one line each. alias double='awk "{print;print}"' ### @- print every line twice.
print every line twice. alias join2='paste -d" " - -' ### @- join every other line. diff --git a/sh/rot13 b/sh/rot13 new file mode 100644 index 0000000..81e4ea8 --- /dev/null +++ b/sh/rot13 @@ -0,0 +1,16 @@ +#!/usr/bin/env sh +# YES_ZSH +# YES_BASH +# YES_DASH + +rot13() { ### @- + ### rot13 with numbers rotated as well. + ### + ### ``` + ### $ rot13 <<< abc123 + ### nop678 + ### ``` + tr -- A-Za-z0-9 N-ZA-Mn-za-m5-90-4 +} + +[ "${SOURCING:-0}" -gt 0 ] || rot13 "$@"