I'm having a surprising large amount of trouble finding a guide on this.
what's wrong with this shell script:
if ["$1" == "-t"]
then
echo "t"
elif ["$1" == "-r"]
then
echo "r"
fi
It's supposed to be a very simple test. if the argument is -t, do one thing, if it's -r do the other.
[ ](<strike>statements</strike>) commands need spaces around the brackets.[]is not a statement.[is a command. Too many people get confused thinking that[is part of the shell grammar, and calling it a "statement" reinforces that error.if/elselike this:case $1 in; -t) echo t;; -r) echo r;; esac