Sample Header Ad - 728x90

Preserve OLDPWD after logging out

2 votes
2 answers
2125 views
I often need to go to the directory I was when I logged out of a server. I habitually use cd - for this purpose. However, after logging out and logging back in this does not work because apparently OLDPWD gets reset: $ cd - -bash: cd: OLDPWD not set Is there a way to preserve the value of OLDPWD beyond a login session in bash?
Asked by Ketan (9426 rep)
Oct 23, 2015, 12:02 AM
Last activity: May 11, 2025, 06:47 PM