Wednesday, 31 May 2017

How to Use “shopt -s cdspell” to automatically correct mistyped directory names on cd in linux

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.
# cd /etc/mall
-bash: cd: /etc/mall: No such file or directory
# shopt -s cdspell
# cd /etc/mall
# pwd
/etc/mail
[Note: By mistake, when I typed mall instead of mail,
cd corrected it automatically]

No comments:

Post a Comment

What is PS2 - Continuation Interactive Prompt in Linux

A very long command can be broken down to multiple lines by giving \ at the end of the line. The default interactive prompt for a multi-lin...