Kind of but not really in a similar vein: I have 'sd' aliased to a small script that goes to the 'next interesting directory', where an 'interesting directory' is one with a visible non-directory or more than one sub-directory. So, for instance, if you're sitting at foo, and underneath you is bar/baz/bat/bit.txt, 'sd bar' will bring you all the way down to bat, and then 'sd ..' will pull you all the way back up to the previous interesting directory.
Just to keep from getting lost, it does a pwd when it gets where it's going, and because typing ls after cd had burned itself into my muscle memory, it goes ahead and does that, too.
It's a small thing, but I really like it for hopping around source trees in languages that use directories to denote package structure.
There's a link there for the "up" command (taking you to some directory higher in your path with that name) and also for "down" (similar downward) and "cdd" which just does a rapid use of locate to find the first directory that matches.
I think what is referred to is bash's source command: when you've modified your .bashrc and you want the changes to be reflected in your current shell process, you do
source .bashrc
or, equivalently
. .bashrc
which runs .bashrc in the current shell, as opposed to in a forked subshell as happens if you did ./.bashrc ; and hence the new functions/aliases/variable settings you've put in .bashrc are now available in the current shell (as opposed to only being visible in a forked subshell and disappearing when it exits).
23 comments
[ 2.0 ms ] story [ 55.5 ms ] threadKind of but not really in a similar vein: I have 'sd' aliased to a small script that goes to the 'next interesting directory', where an 'interesting directory' is one with a visible non-directory or more than one sub-directory. So, for instance, if you're sitting at foo, and underneath you is bar/baz/bat/bit.txt, 'sd bar' will bring you all the way down to bat, and then 'sd ..' will pull you all the way back up to the previous interesting directory.
Just to keep from getting lost, it does a pwd when it gets where it's going, and because typing ls after cd had burned itself into my muscle memory, it goes ahead and does that, too.
It's a small thing, but I really like it for hopping around source trees in languages that use directories to denote package structure.
And a small bash function (since you can only change your shell's pwd from the shell itself):
http://pastebin.com/f5d93d12a
http://github.com/obra/sd/tree/master
Yay for two-letter identifiers. ;)
At work, I have the interesting heads of our source tree in CDPATH, so I can get to most directories I care about by typing their short names.
For instance http://www.macosxhints.com/article.php?story=200503181431142...
With CDPATH, I index it all at the beginning. If I find a new major head in my directory tree, I just add it.
If you want something you can simply add to .bashrc, here are some bash functions to also help jump around to directories you want: http://mattie.posterous.com/some-handy-bash-commands
There's a link there for the "up" command (taking you to some directory higher in your path with that name) and also for "down" (similar downward) and "cdd" which just does a rapid use of locate to find the first directory that matches.
But this is nice and self-contained.
second one, simple - effective
I know where .bashrc is, but simply pasting it into the file seems like .. the wrong way to do it. Couldn't really find an answer on Google