Hızlı yanıt: kod örneği
unix.stackexchange.com what-is-pwd-vs-current-working-directory
That depends on what you're doing. First of all, is an environment variable and is a shell builtin or an actual binary:Now, the bash builtin will simply print the current value of unless you use the flag. As explained in : binary, on the other hand, gets the current directory through the system call which returns the same value as .
To illustrate, try moving into a directory that is a link to another one:So, in conclusion, on GNU systems (such as Ubuntu), and are equivalent unless you use the option, but is different and behaves like .Source
https://askubuntu.com/a/476633/291937
$PWD
pwd
$ type -a pwdpwd is a shell builtinpwd is /bin/pwd
$PWD
-P
help pwd
pwd: pwd [-LP]
- Options:
pwd
getcwd(3)
readlink -f /proc/self/cwd
$ ls -ltotal 4drwxr-xr-x 2 terdon terdon 4096 Jun 4 11:22 foolrwxrwxrwx 1 terdon terdon 4 Jun 4 11:22 linktofoo -> foo/$ cd linktofoo$ echo $PWD/home/terdon/foo/linktofoo$ pwd/home/terdon/foo/linktofoo$ /bin/pwd/home/terdon/foo/foo
pwd
echo $PWD
-P
/bin/pwd
pwd -P