Friday, February 03, 2006

Bash Tips (bash options)

You can set the following bash options in your .bashrc.
Those are my favorite settings and will boost your efficiency of bash usage.

#This one will check the spelling of the path you typed in "cd" command and fixes
#the typo automatically.
#For example, "cd ttmp" will lead you to "tmp" directory, if it exists.
shopt -s cdspell


#You can use Bash variables to create path shortcuts.
#For example, if you have this line in your .bashrc
#"export t=/home/myhome/test/longname".
#Then, in your shell, you can use "cd t", to change directory to the $t
#I created a lot of Bash shortcuts in my .bashrc
shopt -s cdable_vars


#Sometimes, you may noticed that a pause and prompt asking for command selection
#when you pressed "TAB" in an empty command line. It may be annoying (at least for me)
#If you turn on this option, there won't be any completion question in empty command line when you pressed "TAB".
shopt -s no_empty_cmd_completion