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

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
主站蜘蛛池模板: 平乡县| 浮山县| 江西省| 临澧县| 彭泽县| 大厂| 湛江市| 遂平县| 札达县| 客服| 衡阳市| 庄浪县| 嫩江县| 乐安县| 榆中县| 卓尼县| 通江县| 内黄县| 临洮县| 平顶山市| 平南县| 长寿区| 阿拉善右旗| 敖汉旗| 囊谦县| 文水县| 醴陵市| 廊坊市| 新兴县| 丹寨县| 保山市| 晋州市| 应用必备| 鹿邑县| 万州区| 都兰县| 康定县| 新丰县| 大宁县| 改则县| 武威市|