I am trying to test if file file1.c is present in the current working directory, what am I doing wrong with my test command? I thought I understood this command, am I doing something wrong for the Bourne shell that I do not know about?#! /bin/shNAME=$1if((test -e $NAME));thenecho File $NAME presentelseecho File $NAME not presentfi
syntax error: invalid arithmetic operator (error token is .c)
shell;shell script;bourne shell
You don't need the enclosing parentheses, test itself would suffice:if test -e $NAME; thenThe (()) is for arithmetic comparison operations.test is synonymous to [ command, so you can use:if [ -e $NAME ]; thentoo.Also some shell has the [[ keyword:if [[ -e $NAME ]]; then