The command
cd -
will change the pwd to the last directory.
Is there a way to know which directory it is, so that I'll know where I am CD'ing to?
|
|
|
Yes, it is $OLDPWD.
|
|||||||
|
|
You can also use ~- (anywhere you can use tilde expansion) instead of $OLDPWD:
There is also ~+ for $PWD, which is useful for commands which require an absolute directory:
Note that things like |
|||
|
|