Set environment variable with having space linux -
i want set environment variable has space in it. path folder , folder name is: /home/mehrabib/my video
i edit .bashrc , add following line it:
export $video=/home/mehrabib/my\ video
and run these commands:
echo $video cd $video
the result is:
/home/mehrabib/my video /home/mehrabib/my :no such file or directory
i change to
export $video=/home/mehrabib/my\\\ video
and run these commands:
echo $video cd $video
the result is:
/home/mehrabib/my\ video /home/mehrabib/my\ :no such file or directory
what should do?
you should
export video="/home/mehrabib/my video"
and sum dan's comments do
cd "$video"
which expand to
cd "/home/mehrabib/my video"
again.
personally, i've come prefer ${video} syntax.
Comments
Post a Comment