Command inside if statement of bash script [duplicate]
You can run your command without any additional syntax. For example, the following checks the exit code of grep to determine whether the regular expression matches or not: if ! grep -q “$word” /usr/share/dict/words then echo “Word $word is not valid word!” fi