Hack 6. Use “shopt -s cdspell” to automatically correct mistyped directory names on cd

by Ramesh

Use shopt -s cdspell to correct the typos in the cd command automatically as shown below. If you are not good at typing and make lot of mistakes, this will be very helpful.

  1. # cd /etc/mall
  2. -bash: cd: /etc/mall: No such file or directory
  3.  
  4. # shopt -s cdspell
  5.  
  6. # cd /etc/mall
  7.  
  8. # pwd
  9. /etc/mail
  10.  
  11. [Note: By mistake, when I typed mall instead of mail,
  12. cd corrected it automatically]