如何获取当前工作目录

Unix/Linux 获取当前工作目录。

要获取当前工作目录,请使用 pwd 命令。

例如,如果我们将目录更改为 /home/user,pwd 将打印 /home/user 作为当前工作目录:

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

 

在 Bash shell 脚本中,您可以通过以下方式获取当前工作目录:

dir=$(PWD)

 

密码命令 ►

 


Advertising

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