-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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