Remember 4DOS? They had this great feature: if you typed a directory all by itself on a command line, it would jump to that directory. It saved you typing all that
cd nonsense. When you think about it, this makes sense as there is never (at least that I can think of) any other case where just typing a directory does anything else. I mean, why type...
[user@server somedir]$ cd /etc/rc.d/rc0.d/
|
...when you could type...
[user@server somedir]$ /etc/rc.d/rc0.d/
|
It always surprised me that no one implemented this in
bash, and finally I got around to doing it myself. It's a very simply change to only one file.
See below for a patch against
2.05b as well as a binary I compiled on a fairly old system (so that you won't have
clib problems).
If you want to use my binary, just copy it somewhere on your system. Then run it. If it launches ok, you should be good to go.
Note: this new feature does not work in scripts as I enable it only in interactive mode. This is because it is possible that a really lame script would do something like enter the directory by itself and then look for an error code as a way to detect whether a directory is present or not.
And so although it
should be safe it's probably safest to leave
/bin/bash in place, install it as
/bin/bash_patched, and then change it to be your default shell in
/etc/passwd.
(to make a patch, do
diff -Naur old_file new_file > patch_file
--
MattWalsh - 09 Mar 2004