dot

packages and services management
Log | Files | Refs | README

commit 0e21e16cf561c63315024bdd3b3147fc28e633d8
parent c889a911043952168c38ff609fb68bb8c9949e81
Author: Josuah Demangeon <mail@josuah.net>
Date:   Wed, 12 Apr 2017 20:59:13 +0200

case ... in ... esac is an overkill, GNU's tr(1) is broken, so let's go with sed(1)

Diffstat:
Mbin/fun-reverse | 46+++++++---------------------------------------
1 file changed, 7 insertions(+), 39 deletions(-)

diff --git a/bin/fun-reverse b/bin/fun-reverse @@ -1,51 +1,19 @@ -# print a text line by line, with a delaye between every charactery +# print a text with every line upside down while IFS='' read -r line do - line="$(printf %s "$line" | rev)" - while [ "$line" ] - do - char="$(printf %s "$line" | cut -c 1)" - - case "$char" in + printf '%s\n' "$line" | rev | sed ' # lowercase - (a) l='ɐ' ;; (b) l='q' ;; (c) l='ɔ' ;; (d) l='p' ;; - (e) l='ǝ' ;; (f) l='ɟ' ;; (g) l='ƃ' ;; (h) l='ɥ' ;; - (i) l='ᴉ' ;; (j) l='ɾ' ;; (k) l='ʞ' ;; (l) l='j' ;; - (m) l='ɯ' ;; (n) l='u' ;; (o) l='o' ;; (p) l='d' ;; - (q) l='b' ;; (r) l='ɹ' ;; (s) l='s' ;; (t) l='ʇ' ;; - (u) l='n' ;; (v) l='ʌ' ;; (w) l='ʍ' ;; (x) l='x' ;; - (y) l='ʎ' ;; (z) l='z' ;; + y/abcdefghijklmnopqrstuvwxyz/ɐqɔpǝɟƃɥᴉɾʞjɯuodbɹsʇnʌʍxʎz/ # uppercase - (A) l='∀' ;; (B) l='B' ;; (C) l='Ɔ' ;; (D) l='D' ;; - (E) l='Ǝ' ;; (F) l='Ⅎ' ;; (G) l='פ' ;; (H) l='H' ;; - (I) l='I' ;; (J) l='ſ' ;; (K) l='K' ;; (L) l='˥' ;; - (M) l='W' ;; (N) l='N' ;; (O) l='O' ;; (P) l='Ԁ' ;; - (Q) l='Q' ;; (R) l='R' ;; (S) l='S' ;; (T) l='┴' ;; - (U) l='∩' ;; (V) l='Λ' ;; (W) l='M' ;; (X) l='X' ;; - (Y) l='⅄' ;; (Z) l='Z' ;; + y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/∀BƆDƎℲפHIſK˥WNOԀQRS┴∩ΛMX⅄Z/ # digits - (0) l='0' ;; (1) l='Ɩ' ;; (2) l='ᄅ' ;; (3) l='Ɛ' ;; - (4) l='ㄣ' ;; (5) l='ϛ' ;; (6) l='9' ;; (7) l='ㄥ' ;; - (8) l='8' ;; (9) l='6' ;; + y/0123456789/0ƖᄅƐㄣϛ9ㄥ86/ # special characters - (,) l="'" ;; (.) l='˙' ;; (\?) l='¿' ;; (!) l='¡' ;; - (") l='"' ;; (\') l=',' ;; (\`) l=',' ;; - (\() l=')' ;; (\)) l='(' ;; (\[) l=']' ;; (\]) l='[' ;; - ({) l='}' ;; (}) l='{' ;; (\<) l='>' ;; (\>) l='<' ;; - (\&) l='⅋' ;; (_) l='‾' ;; - - (*) l="$char" ;; - - esac - - printf '%s' "$l" - - line="${line#?}" - done - printf '\n' + y/&_/⅋‾/ + ' done