Bash made better with shopt

25 Dec 2009

by hemanth

1.Enable automatic typo correction for directory names
shopt -s cdspell
Testing

hemanth@ubuntu:/var/log$ cd /tp
/tmp
hemanth@ubuntu:/tmp$

hemanth@ubuntu:/$ cd /hom
/home
hemanth@ubuntu:/home$

hemanth@ubuntu:/home$ cd /mt
/mnt
hemanth@ubuntu:/mnt$

2.Enable ** to expand files recursively (>=bash-4.0)
shopt -s globstar
3.Avoiding history file to be overwritten
shopt -s histappend
4.Enable cd by variable names
shopt -s cdable_vars
5.Bash autocomplete case insensitive search
shopt -s nocaseglob
6.Auto cd on ~ to /home/user (>=bash-4.0)
shopt -s autocd

Share this