如何獲取當前工作目錄

Unix/Linux 獲取當前工作目錄。

要獲取當前工作目錄,請使用 pwd 命令。

例如,如果我們將目錄更改為 /home/user,pwd 將打印 /home/user 作為當前工作目錄:

$ cd /home/user
$ pwd
/home/user

 

在 Bash shell 腳本中,您可以通過以下方式獲取當前工作目錄:

dir=$(PWD)

 

密碼命令 ►

 


Advertising

Linux操作系統
°• CmtoInchesConvert.com •°