linux - Command not found in Bash's IF-ELSE condition when using [! -d "$DIR"] -
i have code
#!/bin/bash dir="test_dir/"; if [! -d "$dir"]; # if doesn't create mkdir $dir fi
but why executing gave me this:
./mycode.sh: line 16: [!: command not found
what's right way it?
add space between [ , !. , before ] well.
#!/bin/bash dir="test_dir/"; if [ ! -d "$dir" ]; # if doesn't create mkdir $dir fi
it's idea quote variable:
mkdir "$dir"
Comments
Post a Comment