Shell variable issue when trying to mkdir Shell variable issue when trying to mkdir shell shell

Shell variable issue when trying to mkdir


The quotes prevent the expansion of ~.

Use:

CLIENT_BUILD_DIR=~/Desktop/TempDir/if [ ! -d "$CLIENT_BUILD_DIR" ]then mkdir "$CLIENT_BUILD_DIR"fi


The ~ character is not reinterpret when used in a variable.

You can use CLIENT_BUILD_DIR="$HOME/Desktop/TempDir/" instead.


mkdir ${CLIENT_BUILD_DIR} will do. No directory will be created if it already exists.