I want to create a shell script that echos something if 3 directories don't exist.
Here is the code I wrote: test.sh:
if [ ! -d "/home/unix/POSTagger2" ] || [! -d "/home/unix/POSTagger2/stanford-parser-full-2015-12-09"] || [! -d "/home/unix/POSTagger2/stanford-corenlp-full-2015-12-09"]; then
echo "Nope"
fi
When I run it, I get this error:
./test.sh: line 1: [!: command not found
What's wrong with my syntax?
[
is not a token, it is a command (another name for the commandtest
) as such it must be separated by space(s). Similar case is]
which is a command parameter so it must be separated by a space too. – pabouk Jul 21 '16 at 13:50