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

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -