Any ideas what is wrong with this code?
CLIENT_BUILD_DIR="~/Desktop/TempDir/"
if [ ! -d $CLIENT_BUILD_DIR ]
then
{
mkdir $CLIENT_BUILD_DIR
}
fi
I get the error: mkdir: ~/Desktop: No such file or directory.
Obviously the directory is there and the script works if I replace the variable with ~/Desktop/TempDir/
The quotes prevent the expansion of ~.
Use:
CLIENT_BUILD_DIR=~/Desktop/TempDir/
if [ ! -d "$CLIENT_BUILD_DIR" ]
then mkdir "$CLIENT_BUILD_DIR"
fi
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With