This post is to be an ongoing post on the things I find cool in bash.
Brace completion:
This is really neat. You can make braces expand all possible completions of a name, space separated.
For example:
cp file.c{,.bak}
expands to:
cp file.c file.c.bak
That makes a backup. Each comma separated option within braces is substituted once. That is why the first option copies file.c as is, since its adding nothing.
CDPATH:
CDPATH is a really cool way of quickly going to directories. The idea is simple -cdpath is a list of paths through which directories are searched, not just the current directory. So, for example, if my CDPATH is:
export CDPATH=.:~:/cygdrive/c/code:/cygdrive/c/Documents
And say I have a directory "ftpapp" in code, and "Training", in documents, I can do this:
$ pwd
/cygdrive/c/work/misc/tada
$ cd ftpapp
/cygdrive/c/code/ftpapp
$ pwd
/cygdrive/c/code/ftpapp
$ cd Training
/cygdrive/c/Documents/Training
$ pwd
/cygdrive/c/Documents/Training
CDPATH allows a list of directories to be searched for the directory you are cd-ing to. Tres cool.
No comments:
Post a Comment