bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

"Partial Path" cd


From: Mark Johnson
Subject: "Partial Path" cd
Date: 23 May 2001 20:55:17 GMT

I wrote up some code to do "partial prefix" cd if the argument to cd is
not valid.  (If some one has a better phrase I'd be glad to hear it).

An example:

$ cd /usr/local/TEST.txt 
bash: cd: /usr/local/TEST.txt: Not a directory
$ shopt -s cdpartial
$ cd /usr/local/TEST.txt 
/usr/local
$ pwd
/usr/local
$

I tend to do this a lot after editing a file (vi .../README) and then 
want to change to the directory that had that file in it, so I type
cd ESC-. RET so bash tries to cd /usr/local/README.

So the question is, for Chet especially, is this wanted in Bash?

I did realize (afterwards: doh!) that this could be done with a function,
but after also coding up the shell function I feel the C approach is
cleaner.

-- 
Mark Johnson
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]