Gentoo Archives: gentoo-dev

From: "Sami Näätänen" <sn.ml@××××××××.com>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [Fwd: BASH feature: directory jumping w/o 'cd']
Date: Fri, 12 Mar 2004 21:56:34
Message-Id: 200403122340.52913.sn.ml@bayminer.com
In Reply to: [gentoo-dev] [Fwd: BASH feature: directory jumping w/o 'cd'] by Fred Gates
1 On Friday 12 March 2004 01:28, Fred Gates wrote:
2 > this might qualify to be added to the bash ebuild. might want to vote
3 > and see if enough people like it first. unless its already
4 > implemented in gentoo?
5 >
6 > ---------------------------- Original Message
7 > ---------------------------- Subject: BASH feature: directory jumping
8 > w/o 'cd'
9 > From: "Walsh, Matt" <matt.walsh@×××××.com>
10 > Date: Tue, March 9, 2004 6:59 pm
11 > To: bug-bash@×××.org
12 > ---------------------------------------------------------------------
13 >-----
14 >
15 > This improvement will save you three keystrokes, but they're 3
16 > keystrokes you type a whole lot for no reason at all. Yes, I'm
17 > talking about the keystrokes 'c-d-(space)'
18 >
19 > I was a big fan of the old '4DOS' utility for DOS. One of my
20 > favorite features was where from a command line you could simply type
21 > a directory, and it would go there. I.e., instead of typing
22 >
23 > cd \Windows
24 >
25 > You, in 4DOS could just type
26 >
27 > \Windows
28 >
29 > In BASH, if you try this, it simply complains that "___ is a
30 > directory". In other words, it's a distinct unhandled case. Why not
31 > use this case for something useful?
32 >
33 > So, I made some mods to bash to make this in fact work like it did in
34 > 4DOS. You only have to patch one file, 'execute_cmd.c'
35 >
36 > I threw together this web page with more details.
37 > http://www.mattwalsh.com/twiki/bin/view/Main/BashDirectoryJumpPatch
38 >
39 > I think users will find it addictive; I did with 4DOS and now it's
40 > like falling in love again.
41 >
42 > If it you find a hole in this scheme please let me know. The only
43 > thing I can think of is that some scripts might be sloppy and simply
44 > check to see if a directory exists in this really backwards way. The
45 > code changes were actually very simple. If it looks ok I'll submit a
46 > patch to the BASH mailing list.
47 >
48
49 This would be fine as an option, and I would make it a multi state
50 option like this:
51
52 Off: Default
53 step one: auto cd if the 'command' equals '..'
54 step two: auto cd if the 'command' starts with '.', '..' or '/'
55 step three: auto cd when any directory path has been given as command
56
57
58 --
59 gentoo-dev@g.o mailing list

Replies

Subject Author
Re: [gentoo-dev] [Fwd: BASH feature: directory jumping w/o 'cd'] Georgi Georgiev <chutz@×××.net>