I wrote the following code in the bash shell. It's supposed to take the positional parameter and, if it starts with a dash "-", print an error message. For some reason the if
statement always gets skipped. It only works if I literally input -*
.
I get the impression that the fix has something to do with the $
.
EXECNAME=$1
if [ "$EXECNAME" = "-*" ]; then
echo "error: invalid executable name"
fi