Save current directory in variable using Bash?

后端 未结 9 665
时光说笑
时光说笑 2020-12-07 15:34

What I\'m trying to do is find the current working directory and save it into a variable, so that I can run export PATH=$PATH:currentdir+somethingelse. I\'m not

9条回答
  •  伪装坚强ぢ
    2020-12-07 16:03

    This saves the absolute path of the current working directory to the variable cwd:

    cwd=$(pwd)
    

    In your case you can just do:

    export PATH=$PATH:$(pwd)+somethingelse
    

提交回复
热议问题