BASH - "Ramping up" $OLDPWD - possible?
I'm more than a bit disappointed with the limits of the internal variable $OLDPWD in BASH. My analogy for it is as follows:
A fellow who lives in a two-story house gets up in the morning. He goes out to his porch after getting dressed. He comes back in, goes into his kitchen downstairs and cooks breakfast. He eats his breakfast in his dining room. Then he goes upstairs to his home office/study. In the middle of looking for a book, a call of nature brings him to the upstairs bathroom. While he's there, he crosses the hallway outside and gets a new can of shaving cream out of a closet. Then he returns to the bathroom and shaves. On finishing this task, he returns to the home office room, sits down at the computer and starts his email application. An email from a friend asks him what he's been up to that morning. The only thing he can remember is being in the upstairs bathroom, shaving.
I'm not implying it should remember all the cd (change directory) commands in a session; just one more cached for the $OLDPWD variable would be an improvement on things, however.
If BASH can't be "ramped up" in the way I'm describing, is there already a shell with a better "memory," a better handle on where one has been in terms of directory navigation, and has variables or built-in commands to prove it?
You could make use of pushd instead of cd. You would then have a history of your previous directories by using the command dirs. You can use cd ~n to change to the nth directory in the dirs list.
The $CDPATH variable is also useful as a way of setting up a lot of commonly used directories.
|All times are GMT -5. The time now is 10:34 PM.|