getting expr : syntax error while executing script
getting an error for executing the following
for (( i = 1; i <= 9; i++ )) do for (( j = 1; j <= 9; j++ )) do tot=`expr $i +sj` tmp=`expr $tot % 2` if [ $tmp=0 ] then echo -e -n "\033[47m " ## for black color else echo -e -n "\033[40m " ## for white color fi done echo -e -n "\033[47m" echo "" ### print the new line ### done |
What you are trying to do ??
there are many mistakes in this script.. Code:
tot=`expr $i + $j` Code:
echo -e -n "\033[47m " ## for black color |
You should have spaces between your conditional operands.
Code:
if [ "$tmp" = 0 ] Your arithmetic expressions could also be better done with (( )) as well. Run help let; help '(('. |
Use correct operator '-eq' & double [[ ]]
Code:
if [[ tmp -eq 0 ]] http://tldp.org/LDP/abs/html/comparison-ops.html |
All times are GMT -5. The time now is 09:09 PM. |