On Tue, Oct 14, 2008 at 1:07 PM, Andrew Farnsworth <[EMAIL PROTECTED]> wrote: > On Tue, Oct 14, 2008 at 1:44 PM, Douglass Clem <[EMAIL PROTECTED]> > wrote: >> >> What exactly is pushd and popd? I looked for executable by those names on >> my machine (Ubuntu 8.04), but did not find any. > > They are shell builtin commands just like the cd command. No actual > executable. > > Just try it as follows: > > cd /etc > pushd /var > pwd returns /var > popd > pwd return /etc > > basically, it saves your current directory into a stack and changes to the > new directory you specify. It works just like the cd command but saves your > previous directory. Since this is a stack, it is repeatable more than once > so just try this... > > cd /etc > pushd /var > pushd /root > pushd / > > pwd returns / > popd > pwd returns /root > popd > pwd returns /var > popd > pwd returns /etc > > Andy >
Steven, is "sourcing" the same as "dotting in" a script? It sounds like the way I've seen to reload your .bashrc settings without having to log out: $ echo "FOOBAR=BAZ" >> .bashrc $ env |grep FOO $ . .bashrc $ env |grep FOO FOOBAR=BAZ Reading the article, I found myself uneasy about #'s 1, 2, and 6. They seem like easy sources of confusion and danger. After testing, #1 is the only one that I would really shy away from. Also, notice that the article has a root prompt in these examples? I don't want to play these shell games as root. #1. cdpath: If you set cd path and the directories in the path conflict with local directories, cd might not work as you expect. For this (overly dramatic) example, assume you set CDPATH=/etc in root's .bash_profile # pwd /root # mkdir -p mail/oops # cd mail # rm -rf * # pwd /etc/mail #2. alias ..="cd ..": Again, I think there's potential for name conflicts. I envisioned a situation where there is an executable in your current directory that share's a name with the parent directory and might run if . is in your PATH, but I wasn't able to make it happen in testing. #6.cdspell: I haven't heard of this option before, but it seems like an accident waiting to happen. It didn't like the idea of letting the computer "fix" my typos and putting me in directories that I didn't explicitly type. After testing, it's not so bad. It usually gets things right and always lets you know what directory you went to. I was able to confuse it, but the visual confirmation should be a good enough alert. $ mkdir foob $ mkdir foobk $ cd fook foob $ cd ../foobk On the other hand, I thought #3 was really clever. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "NLUG" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/nlug-talk?hl=en -~----------~----~----~----~------~----~------~--~---
