micro edit to add space support

This commit is contained in:
thatgeekyweeb 2021-10-08 02:23:58 -04:00
parent 375297c232
commit 0566ed32f5
1 changed files with 8 additions and 7 deletions

15
morsh
View File

@ -6,19 +6,20 @@
# SC2154 - eval sets $cur # SC2154 - eval sets $cur
IFS=""; LANG=C IFS=""; LANG=C
# index's # index's
index="A:B:C:D:E:F:G:H:I:J:K:L:M:N:O:P:Q:R:S:T:U:V:W:X:Y:Z:1:2:3:4:5:6:7:8:9:0" # 36 items index="A:B:C:D:E:F:G:H:I:J:K:L:M:N:O:P:Q:R:S:T:U:V:W:X:Y:Z:1:2:3:4:5:6:7:8:9:0: " # 36 items
indexl="a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:q:r:s:t:u:v:w:x:y:z:1:2:3:4:5:6:7:8:9:0" # lowercase index for ascii indexl="a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:q:r:s:t:u:v:w:x:y:z:1:2:3:4:5:6:7:8:9:0: " # lowercase index for ascii
exb=".-:-...:-.-.:-..:.:..-.:--.:....:..:.---:-.-:.-..:--:-.:---:.--.:--.-:.-.:...:-:..-:...-:.--:-..-:-.--:--..:.----:..---:...--:....-:.....:-....:--...:---..:----.:-----" exb=".-:-...:-.-.:-..:.:..-.:--.:....:..:.---:-.-:.-..:--:-.:---:.--.:--.-:.-.:...:-:..-:...-:.--:-..-:-.--:--..:.----:..---:...--:....-:.....:-....:--...:---..:----.:-----:/"
ma() { ma() {
eval letter=\${$#} eval letter=\${$#}
eval cur=\${$letter}; printf '%s' "$cur" eval cur=\${$letter}; [ "$cur" = 37 ] && cur=" " # IFS=": " causes #37 in $index to be lost
printf '%s' "$cur"
} }
am() { am() {
IFS="" IFS=""
eval letter=\${$#}; eval letter=\${$#};
[ $letter -gt 36 ] && : $((letter-=36)) [ $letter -gt 37 ] && : $((letter-=37))
eval cur=\${$letter}; printf '%s ' "$cur" eval cur=\${$letter}; printf '%s ' "$cur"
} }
@ -43,8 +44,8 @@ while read -r p || [ -n "$p" ]; do
IFS=":"; na="0"; for ai in ${index} ${indexl}; do IFS=":"; na="0"; for ai in ${index} ${indexl}; do
# echo $ai # echo $ai
: $((na+=1)) : $((na+=1))
case "$ai" in case "${p%$next}" in
"${p%$next}") am $exb $na; break;; "$ai") am $exb $na; break;;
esac esac
done done
na=0 na=0