- 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
推薦閱讀
- 大數(shù)據(jù)導(dǎo)論:思維、技術(shù)與應(yīng)用
- 工業(yè)機器人產(chǎn)品應(yīng)用實戰(zhàn)
- Deep Learning Quick Reference
- Matplotlib 3.0 Cookbook
- Photoshop CS3特效處理融會貫通
- 完全掌握AutoCAD 2008中文版:綜合篇
- Spark大數(shù)據(jù)技術(shù)與應(yīng)用
- CentOS 8 Essentials
- 深度學(xué)習與目標檢測
- Visual Studio 2010 (C#) Windows數(shù)據(jù)庫項目開發(fā)
- 一步步寫嵌入式操作系統(tǒng)
- Drupal高手建站技術(shù)手冊
- 電動汽車驅(qū)動與控制技術(shù)
- 計算機應(yīng)用基礎(chǔ)實訓(xùn)·職業(yè)模塊
- Serverless Design Patterns and Best Practices