Any Bash features you'd like to see?

Chris F.A. Johnson cfaj-uVmiyxGBW52XDw4h08c5KA at public.gmane.org
Wed May 11 21:14:00 UTC 2005


On Wed, 11 May 2005, John Vetterli wrote:

> On Wed, 11 May 2005, Taavi Burns wrote:
>>  On 5/11/05, John Vetterli <jvetterli-zC6tqtfhjqE at public.gmane.org> wrote:
>> >  I'd like to have some sort of directory history (i.e. as I cd from
>> >  directory to directory, have bash remember the last N directories I
>> >  visited, and be able to go back).
>>  You mean 'pushd' and 'popd'?  (well, it might be nice to not have to
>>  specify pushd)
>
> Um, yeah, something like that.  Boy, William implemented that one pretty 
> quickly, eh?
>
> I guess you could do some magic with alias to avoid having to use pushd.

cd() { pushd "${@:-$HOME}"; }

cdx() { popd "$@"; }

    You might want to improve on the cd function to handle the -P and -L
    options to cd.

-- 
     Chris F.A. Johnson                     <http://cfaj.freeshell.org>
     ==================================================================
     Shell Scripting Recipes: A Problem-Solution Approach, 2005, Apress
     <http://www.torfree.net/~chris/books/ssr.html>
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list