Skip to content

Instantly share code, notes, and snippets.

@chx
Last active December 29, 2015 10:39
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save chx/7657981 to your computer and use it in GitHub Desktop.
Save chx/7657981 to your computer and use it in GitHub Desktop.
Dump anything with the nato spelling: save it in a file called nato, put in your PATH, chmod +x nato and then nato foobar will print: Foxtrot Oscar Oscar Bravo Alpha Romeo
#!/bin/bash
declare -A nato
nato[A]=Alpha
nato[B]=Bravo
nato[C]=Charlie
nato[D]=Delta
nato[E]=Echo
nato[F]=Foxtrot
nato[G]=Golf
nato[H]=Hotel
nato[I]=India
nato[J]=Juliet
nato[K]=Kilo
nato[L]=Lima
nato[M]=Mike
nato[N]=November
nato[O]=Oscar
nato[P]=Papa
nato[Q]=Quebec
nato[R]=Romeo
nato[S]=Sierra
nato[T]=Tango
nato[U]=Uniform
nato[V]=Victor
nato[W]=Whiskey
nato[X]=X-ray
nato[Y]=Yankee
nato[Z]=Zulu
x=$1
for (( i=0; i<${#x}; i++ ))
do
letter=${x:$i:1}
letter=${letter^^}
echo ${nato[$letter]}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment