linux - Shell variable issue when trying to mkdir -
any ideas wrong code?
client_build_dir="~/desktop/tempdir/" if [ ! -d $client_build_dir ] { mkdir $client_build_dir } fi
i error: mkdir: ~/desktop: no such file or directory.
obviously directory there , script works if replace variable ~/desktop/tempdir/
the quotes prevent expansion of ~.
use:
client_build_dir=~/desktop/tempdir/ if [ ! -d "$client_build_dir" ] mkdir "$client_build_dir" fi
Comments
Post a Comment