Linux命令:pwd

打印当前目录的完全路径。

-L  打印路径包含符合路径

-P  打印路径不含符合路径。

-LP,可能打印的不同,取决于你对进入当前目录的方式是通过符号链接进入,还是物理目录进入。如果是符号链接进入,则-L和不带-L打印的一样,和-P的不一样;如果是从物理目录进入的,则所有情况打印的都一样。

换言之,要判断自己是否通过符号链接进入的,或者什么符号链接进入的,可以用pwd -L和pwd -P的打印进行比较来确定。

help pwd

 1 pwd: pwd [-LP]
 2     Print the name of the current working directory.
 3 
 4     Options:
 5       -L        print the value of $PWD if it names the current working
 6         directory
 7       -P        print the physical directory, without any symbolic links
 8 
 9     By default, `pwd' behaves as if `-L' were specified.
10 
11     Exit Status:
12     Returns 0 unless an invalid option is given or the current directory
13     cannot be read.

猜你喜欢

转载自www.cnblogs.com/ChinaGo/p/10627264.html