I am having a difficulty with an arithmetic syntax error.
I am reading the name of text files from the command line and count the number of the lines of each file.
NUM=$(wc -l "$text")
and then I want to check whether NUM is odd or not.
So I put,
REMAINDER=$(( $NUM % 2 )) if [ $REMAINDER -ne 0 ] ; then echo "Odd number" fi
However, it seems like there is a problem with
REMAINDER=$(( $NUM % 2 ))
$NUM doesn't seem to be regarded as a number but a '.txt' file. When I checked NUM by itself and it worked fine...