Is it a good idea to use the following alias:
cd() {
pushd $1;
}
in bash?
I think this would be very useful, since I can then use a series of popds instead of just a cd - once.
Is there any case where this might be a problem?
|
Is it a good idea to use the following alias:
in bash? I think this would be very useful, since I can then use a series of Is there any case where this might be a problem? |
||||
|
Personally, I have these in my bashrc and use them all the time:
You can then navigate around on the command-line a bit like a browser. The only real problem that I'm aware of is the fact that it's then a set of commands that I'm completely used to but don't exist on anyone else's machine. So, if I have to use someone else's machine, it can be a bit frustrating. If you're used to just using I would note, however, that your particular implementation of So, as I said, I use these aliases all the time and have no problem with them. It's just that it can be a bit frustrating to have to use another machine and then find them not there (which shouldn't be surprising, but they're one of those things that you use so often that you don't think about them, so having them not work like you're used to can still be surprising). |
||||
|
|
This isn't a direct answer to the question, but I fell in love with the directory history window in 4DOS. So much so that I wrote my own version for Linux (and Cygwin). I've never gotten around to making it an easy-to-install utility, but if you know your way around a Bash prompt, it shouldn't be that hard to get running. Your question inspired me to put it into a Git repo and upload it to GitHub: dirhistory. Basically, it's a daemon that collects directory changes from all your shells, and a Cdk program that displays the history and lets you pick any directory to switch to (so you're not limited to a stack). I find it really useful, and have it bound to Ctrl-PageUp, just like 4DOS did. (I even patched PuTTY so it would send Ctrl-PageUp to Bash.) |
||||
|
|
alias cd=pushd? – Falmarri Nov 23 '10 at 18:15pd? Are you the only user and administrator of your system? – Kevin Cantu Nov 23 '10 at 18:23autopushd– Michael Mrozek♦ Nov 23 '10 at 19:05