LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 02-16-2010, 01:02 AM   #1
SilversleevesX
Member
 
Registered: May 2009
Posts: 181
Blog Entries: 9

Rep: Reputation: 15
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?

BZT
 
Old 02-16-2010, 01:38 AM   #2
neonsignal
Senior Member
 
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Wheezy (Fluxbox WM)
Posts: 1,363
Blog Entries: 52

Rep: Reputation: 353Reputation: 353Reputation: 353Reputation: 353
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.

Last edited by neonsignal; 02-16-2010 at 01:53 AM.
 
  


Reply

Tags
bash, directory, extend, navigation, shell


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
bash script: using "select" to show multi-word options? (like "option 1"/"o zidane_tribal Programming 6 03-21-2013 10:35 AM
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 10:18 PM
bash-2.05b# Xlib: extension "XFree86-DRI" missing on display ":0.0". citrus Linux - General 8 02-22-2004 10:43 AM


All times are GMT -5. The time now is 09:31 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration