击:当前目录变量 [英] Bash: current directory variable
本文介绍了击:当前目录变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图做的是找到当前工作目录,并将其保存到一个变量,这样我可以运行出口PATH = $ PATH:currentdir + somethingelse
。 :不是完全肯定,如果他们有一个默认包含CWD的变量
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
. :s not entirely sure if they have a variable that contains cwd by default.
推荐答案
这保存到变量当前工作目录的绝对路径 CWD
:
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
这篇关于击:当前目录变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文