I am in a directory /tmp/test. $ pwd /tmp/test Now I deleted this directory from another session and fired the command pwd on the previous session. What will be the output of the pwd command?
-
/tmp/test
-
Directory does not exist
-
/tmp
-
None of these
A
Correct answer
Explanation
The pwd command displays the current working directory path that the shell has stored in its internal context. When you delete the directory from another session, the original shell session still retains knowledge of its previous working directory path, so pwd continues to show /tmp/test. The shell does not continuously validate whether the directory still exists on the filesystem.