Monday, August 17, 2009

Bash SpellChecker

Reason for this post is that i tend do a lot of typing mistakes while typing at the terminal:-).
Spell checking in bash can be enabled adding the following line below into your bashrc file

shopt -s cdspell

#pradeep@pradeep-laptop:gedit ~/.bashrc

Add the command mentioned above to the end of the file and save.

That’s all :)

If you want to enable this for all the users, then append this to your /etc/bash.bashrc (in Ubuntu) or /etc/bashrc (in Fedora). Of course, you need the root privilege to edit the files in /etc.

Now try these
cd /hoem
cd /hoe

Ain't it cool.

So by the way what is a bashrc file?
Ok in short it is a script which is run by the bash shell when ever a terminal is invoked once you login.
To know more please see /usr/share/doc/bash/INTRO.gz as in "Ubuntu 9.04". Not sure about other versions. It should be the same according to me.