Question: help me to debug this #if binary numer is 1 then print X; Otherwise, print (space) instead convertBinaryToArt(){ binnum=$1 zero=$2 one=$3 numdigits=`expr ${binnum}` digitpos=0
help me to debug this
#if binary numer is 1 then print "X"; Otherwise, print " "(space) instead convertBinaryToArt(){ binnum=$1 zero=$2 one=$3 numdigits=`expr ${binnum}` digitpos=0 convnum="" while [ $digitpos -lt $numdigits ]; do. line 70 digit=${binnum:$digitpos:1} if [ "$digit" = "0" ]; then convnum="${convnum}$zero" else convnum="${convnum}$one" fi digitpos=`expr $digitpos +1` done echo "convnum" }
Try 'expr --help' for more information.
./new.sh: line 71: [: 0: unary operator expected
convnum
./new.sh: line 145: 01010001: command not found
expr: missing operand
Try 'expr --help' for more information.
./new.sh: line 71: [: 0: unary operator expected
convnum
./new.sh: line 145: 01010001: command not found
expr: missing operand
Try 'expr --help' for more information.
./new.sh: line 71: [: 0: unary operator expected
convnum
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
