Browse Source

initial commit

master
Ben Savage 8 years ago
commit
3244f7b109
  1. 16
      nato

16
nato

@ -0,0 +1,16 @@
#!/bin/bash
function ord () {
printf "%d" "'$1"
}
alpha=(space exclamation_mark quotation_mark hash dollar_sign percentage_sign apmersand apostrophe open_bracket close_bracket asterisk plus_sign comma hyphen full_stop forward_slash zero one two three four five six seven eight niner colon semicolon open_triangle_bracket equals_sign close_triangle_bracket question mark alpha bravo charlie delta echo foxtrot golf hotel india juliette kilo lima mike november oscar papa quebec romeo sierra tango uniform victor whiskey xray yankee zulu open_square_bracket backslash close_square_bracket caret underscore backtick . . . . . . . . . . . . . . . . . . . . . . . . . open_curly_bracket pipe close_curly_bracket tilde)
string="${*}"
for (( i=0 ; i < ${#string}; i++)); do
char="${string:$i:1}"
nato=${alpha[$(( $(ord "${char^^}") - 32))]}
if ! [ $(ord "$char") -gt 96 ];then nato=${nato^^};fi
echo -ne "$nato "
done
echo
Loading…
Cancel
Save