I have a code like this
#!/bin/bash DIR=\"test_dir/\"; if [! -d \"$DIR\"]; then # If it doesn\'t create it mkdir $DIR fi
But why
Add space between [ and !. And before ] as well.
#!/bin/bash DIR="test_dir/"; if [ ! -d "$DIR" ]; then # If it doesn't create it mkdir $DIR fi
It's also a good idea to quote your variable:
mkdir "$DIR"