Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #--------------------------------------------------------------------------------------------
- # Use:
- # echo "Some message" | ./tapcode.sh
- # cat somefile.doc | ./tapcode
- # Message can only contain a-z or A-Z,
- # No numbers (unless spelled out) and
- # no punctuation.
- # A call sign with a K might be better off
- # spelling out the NATO phonetic:
- #
- # echo "Kilo E eight GGD" |./tapcode.sh
- #
- # 1,3 2,4 3,1 3,4 - 1,5 - 1,5 2,4 2,2 2,3 4,4 - 2,2 2,2 1,4
- #
- # I've added the dashes (-) simply as a
- # visual marker between words.
- #
- # To read about Tap Code see Wikipedia:
- # https://en.wikipedia.org/wiki/Tap_code
- #
- #--------------------------------------------------------------------------------------------
- tr "[:lower:]" "[:upper:]" |tr '\n' ' '| (
- # while loop
- while IFS= read -r -n1 c
- do
- case "$c" in
- A) echo -n "1,1 " ;;
- B) echo -n "1,2 " ;;
- C) echo -n "1,3 " ;; # Same as K
- D) echo -n "1,4 " ;;
- E) echo -n "1,5 " ;;
- F) echo -n "2,1 " ;;
- G) echo -n "2,2 " ;;
- H) echo -n "2,3 " ;;
- I) echo -n "2,4 " ;;
- J) echo -n "2,5 " ;;
- K) echo -n "1,3 " ;; # Same as C
- L) echo -n "3,1 " ;;
- M) echo -n "3,2 " ;;
- N) echo -n "3,3 " ;;
- O) echo -n "3,4 " ;;
- P) echo -n "3,5 " ;;
- Q) echo -n "4,1 " ;;
- R) echo -n "4,2 " ;;
- S) echo -n "4,3 " ;;
- T) echo -n "4,4 " ;;
- U) echo -n "4,5 " ;;
- V) echo -n "5,1 " ;;
- W) echo -n "5,2 " ;;
- X) echo -n "5,3 " ;;
- Y) echo -n "5,4 " ;;
- Z) echo -n "5,5 " ;;
- " ") echo -n "- " ;;
- esac
- done
- )
- echo ""
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement