This commit is contained in:
thatgeekyweeb 2021-10-18 04:00:00 -04:00
parent dc07f0d2af
commit c923f286ac
2 changed files with 9 additions and 8 deletions

9
README
View File

@ -1,12 +1,13 @@
# Morsh
- The physical form of pure insanity.
-- Morse code puresh decoder/encoder
## Usage
---
$ echo "<your morse code here>" | ./mosrh
<your translated hell here>
<decoded text here>
$ echo "sample" | ./morese
<encoded text here>
---
~ meeper is an amazing <>, they drive me to new limits
-- meeper is a really cool dude

8
morsh
View File

@ -1,5 +1,5 @@
#!/bin/sh
# -. --- - .. -.-. . -- . -- . . .--. . .-.
# -. --- - .. -.-. . / -- . / -- . . .--. . .-.
# shellcheck disable=SC2086,SC1083,SC2154
# SC2086 - required for IFS replacement
# SC1083 - required for eval
@ -28,7 +28,7 @@ unset bang; line=1; while read -r p || [ -n "$p" ]; do
[ "$line" -eq 1 -o "$bang" ] 2>/dev/null && { # start comment check # this is basically a shitpost lol
case "$p" in
'#'!*) bang=" ";;
'#'*) p="${p#\#}"; printf '%sl: %s\n#' "${bang# }" "${line}"
'#'?-*|'#'?.*) p="${p#\#}"; printf '%sl: %s\n# ' "${bang# }" "${line}"
bang='
' # big hack to add newlines to start if >1
n1="0"; IFS=": "; for i in ${p}; do
@ -41,10 +41,10 @@ unset bang; line=1; while read -r p || [ -n "$p" ]; do
n1=0
done ;;
esac # this only converts morse
[ "$bang" ] && unset p
[ "$bang" ] && p="?"
}
case "$p" in
#"") ;; # skip empty lines
"") echo ;; # skip empty lines
-*|.*)
# for morse to ascii
n1="0"; IFS=": "; for i in ${p}; do