I have written a shell script which takes file name as parameter e.g user/test.txt. I want to make this file parameter optional if user does not wish to provide file name he/she can give as "None"
Inside script I'm just checking if filename parameter contains "None"
if [ $filename -eq "NONE" ];then
cmd;
fi
When "None" is passed as parameter script works fine but when user/test.txt is passed I get below error message which I don't want to print on console
arithmetic syntax error
Can somebody help ?
Best Answer
[ bla bla bla ]
is equivalent totest bla bla bla
.From
man test
Therefore you need
=
not-eq
.