Set environment variable with space in Linux

前端 未结 3 855
一向
一向 2020-12-15 03:13

I want to set an environment variable that has space in it. it is a path to a folder and the folder name is: /home/mehrabib/my video

I edit .bashrc and add the follo

3条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-15 03:46

    You should do

    export VIDEO="/home/mehrabib/my video"
    

    and to sum Dan's comments up also do

    cd "$VIDEO"
    

    which will expand to

    cd "/home/mehrabib/my video"
    

    again.

    Personally, I've come to prefer the ${VIDEO} syntax.

提交回复
热议问题