Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ cat n2w
- #! /bin/bash
- [ $# -eq 1 ] && expr "$1" : '^[0-9]*$' >/dev/null 2>&1 || {
- echo 1>&2 "Command format is \"$(basename $0) n\"."
- exit 1
- }
- # 0 1 2 3 4 5 6 7 8 9
- d2l=( '' '' abc def ghi jkl mno pqrs tuv wxyz )
- n=$1
- p=''
- while (( n > 0 )) ; do
- (( d = n % 10 ))
- (( n = n/10 ))
- if (( d > 1 )) ; then
- p="[${d2l[$d]}]$p"
- fi
- done
- grep -i "^$p\$" /usr/share/dict/american-english
- $ ./n2w 228
- act
- bat
- cat
- $ ./n2w 96737
- words
- $ ./n2w 6862377
- Numbers
- numbers
- $ ./n2w 2244744
- $ ./n2w 4744
- $ ./n2w 2243224
- $ ./n2w 3224
- each
- $
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement