- Bash Quick Start Guide
- Tom Ryder
- 128字
- 2021-07-23 16:58:59
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
推薦閱讀
- 機(jī)器學(xué)習(xí)實(shí)戰(zhàn):基于Sophon平臺(tái)的機(jī)器學(xué)習(xí)理論與實(shí)踐
- 玩轉(zhuǎn)智能機(jī)器人程小奔
- 腦動(dòng)力:Linux指令速查效率手冊(cè)
- AutoCAD繪圖實(shí)用速查通典
- Hands-On Artificial Intelligence on Amazon Web Services
- Windows XP中文版應(yīng)用基礎(chǔ)
- 大數(shù)據(jù)時(shí)代的數(shù)據(jù)挖掘
- 精通Excel VBA
- Google App Inventor
- Visual C++編程全能詞典
- Storm應(yīng)用實(shí)踐:實(shí)時(shí)事務(wù)處理之策略
- Photoshop行業(yè)應(yīng)用基礎(chǔ)
- 教育機(jī)器人的風(fēng)口:全球發(fā)展現(xiàn)狀及趨勢(shì)
- 在實(shí)戰(zhàn)中成長(zhǎng):Windows Forms開(kāi)發(fā)之路
- Flink原理與實(shí)踐