You are not logged in.
Pages: 1
Hi!
Is there any downside to
a) using pushd instead of cd
b) alias it to cd
?
Or can I somehow switch to the last directory with cd (more than one time by "cd -") too?
Also I've never seen a script use pushd/popd, but just in case one does (or uses extended cd features I don't understand) - can I alias it in a way that makes scripts not use it (I'd say no, but maybe there is a solution non the less)?
Maybe I would have to flush the stack from time to time if I did that (although It doesn't take much space, if I don't restart for a few days and compile a lot it might take a little) - or is it imitable on some way? There seems to be no manual entry for pushd / popd and I can't remember/find where I read about it in the first place any more...
thanks!
Last edited by whoops (2009-06-05 15:06:57)
Offline
in the top of my .bashrc i have
# exit if we're in a script
[ -z "$PS1" ] && return
that way scripts always get a clean environment. this has it's [dis]advantages depending on your usage.
i have a couple scripts that pushd to a working directory to extract / sed some files then popd back out before finishing the script, it's useful.
i've seen alot of pushd / cd alias/function setups that look quite useful, google should show you.
//github/
Offline
Thx, then I'll keep the '[ -z "$PS1" ] && return' in mind and experiment a little.
Yes, google found a lot of stuff, but a lot of crap too and I wasn't too sure about the quality of the rest (I try to recall how easy it is to google-find tutorials on how to use root as main user the whole time in ubuntu/vista/etc too, whenever I'm about to use scripts / stuff I don't understand that well).
As there hasn't been anyone screaming "Noooo, you will make your *** mess up your ***!!!!" or something like this yet, I guess that one's google-[solved]-able from this point on.
Offline
Pages: 1