isefire icon

CodeEval HiddenNumbers

isefire | PRO | 09/16/14 10:04:56 PM UTC | 0 ⭐ | 430 👁️ | Never ⏰ | []
Bash |

1.06 KB

|

None

|

0 👍

/

0 👎

#!/bin/bash
#echo "Hello, Dan"
filename="$1"
#echo $filename
#line="head -n 0 $filename"
#echo $line
returned=""
while VAR= read -r -n1 char $line
do
# what am i doingf
    X=$char
    if [ "$X" == "a" ] || [ "$X" == "0" ]
    then
        returned="$returned""0"
    fi
    if [ "$X" == "b" ] || [ "$X" == "1" ]
    then
        returned="$returned""1"
    fi
    if [ "$X" == "c" ] || [ "$X" == "2" ]
    then
        returned="$returned""2"
    fi
    if [ "$X" == "d" ] || [ "$X" == "3" ]
    then
        returned="$returned""3"
    fi
    if [ "$X" == "e" ] || [ "$X" == "4" ]
    then
        returned="$returned""4"
    fi
    if [ "$X" == "f" ] || [ "$X" == "5" ]
    then
        returned="$returned""5"
    fi
    if [ "$X" == "g" ] || [ "$X" == "6" ]
    then
        returned="$returned""6"
    fi
    if [ "$X" == "h" ] || [ "$X" == "7" ]
    then
        returned="$returned""7"
    fi
    if [ "$X" == "i" ] || [ "$X" == "8" ]
    then
        returned="$returned""8"
    fi 
    if [ "$X" == "j" ] || [ "$X" == "9" ]
    then
        returned="$returned""9"
    fi
    #is end of line?
    if [ "$X" == "" ]
    then
        if [ "$returned" != "" ]
        then
            echo $returned
            returned=""
        else
            echo NONE
        fi
        
    fi
done < $1

Comments