官术网_书友最值得收藏!

The pwd command

The pwd Bash builtin prints the current working directory for the script to the standard output:

$ pwd
/home/bashuser
This information is also available in the PWD environment variable, which can be more flexible to use in scripts.

The working directory for the shell refers to the directory from which all relative paths are based, even if they have multiple levels of directories in them:

$ pwd
/home/bashuser/docs
$ ls important/doc1.txt
important/doc1.txt
$ ls doc2.txt
doc2.txt
$ ls nonexistent
ls: cannot access 'nonexistent': No such file or directory

Any path that starts with a forward slash  a leading slash  is instead an absolute path, and resolves independently of the current directory:

$ ls /home/bashuser/important/doc1.txt
/home/bashuser/important/doc1.txt
$ ls /home/bashuser/doc2.txt
/home/bashuser/doc2.txt
主站蜘蛛池模板: 分宜县| 本溪市| 丰都县| 吉隆县| 沂水县| 新竹市| 安岳县| 大洼县| 大姚县| 萝北县| 永仁县| 四子王旗| 吴堡县| 康平县| 岗巴县| 辽宁省| 玉林市| 陇南市| 南乐县| 蓝田县| 陇川县| 汪清县| 铅山县| 许昌县| 顺昌县| 东方市| 白朗县| 乐亭县| 重庆市| 勐海县| 陕西省| 甘孜县| 天门市| 丰都县| 仁布县| 舟山市| 林口县| 余姚市| 丽水市| 陈巴尔虎旗| 荥阳市|