nixCraft Linux Forum

nixCraft

Linux / UNIX Tech Support Forum

Spell Check In Bash Shell

This is a discussion on Spell Check In Bash Shell within the Getting started tutorials forums, part of the Linux Getting Started category; Hello Peoples, Again in my studies I have came across a cool bash trick that I tested on my Red ...


Go Back   nixCraft Linux Forum > Linux Getting Started > Getting started tutorials

Linux answers from nixCraft.


Getting started tutorials So much to read, so little time! If that is your problem, we have solution. Read our FAQ and tutorials to help you cut through the clutter of information overload. Only members of "contributors" group can post new tutorials. Other members can just reply to thread.

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 26-09-2009, 09:56 PM
jaysunn's Avatar
Powered By Linux
User
 
Join Date: Apr 2009
Location: 41.332032,-73.089775
OS: RHEL - OSX
Scripting language: BASH - Learning Ruby
Posts: 604
Thanks: 61
Thanked 80 Times in 72 Posts
Rep Power: 10
jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold jaysunn is a splendid one to behold
Default Spell Check In Bash Shell

Hello Peoples,

Again in my studies I have came across a cool bash trick that I tested on my Red Hat Linux Server.

For someone who does not always use the tab completion for traversing directory hierarchy. Then you may find this hack interesting.


If you edit with your favorite editor your .basrc file in your home directory. You can add this text to the file to assist you with misspelled directory changes. Have a look:


First edit your .bashrc file in the home directory.

Code:
[root@radio5 ~]# vi ~/.bashrc
Now add the following to the file.

Code:
shopt -s cdspell
Now logout and log back in. And check if it is working by miss typing a directory change.

Code:
[root@radio5 ~]# cd /var/lg
/var/log
[root@radio5 log]#
As you can see I tried to type cd /var/log however I miss typed /var/lg missing the o.

Bash automatically spits out the correct path.

Have fun,

Jaysunn
__________________
Have a look at what I have been working on
http://www.shellasaurus.com

Last edited by jaysunn; 28-09-2009 at 05:11 AM.
Reply With Quote
The Following User Says Thank You to jaysunn For This Useful Post:
chiku (28-09-2009)
  #2 (permalink)  
Old 28-09-2009, 04:39 AM
chiku's Avatar
Member
User
 
Join Date: Feb 2005
OS: Fedora
Posts: 86
Thanks: 10
Thanked 0 Times in 0 Posts
Rep Power: 0
chiku is on a distinguished road
Default

10x for command!!!
__________________
There's no place like 127.0.0.1
Reply With Quote
  #3 (permalink)  
Old 30-12-2009, 06:53 PM
Member
User
 
Join Date: May 2009
OS: Mandriva
Posts: 82
Thanks: 0
Thanked 16 Times in 16 Posts
Rep Power: 3
cfajohnson has a spectacular aura about cfajohnson has a spectacular aura about cfajohnson has a spectacular aura about
Default

Quote:
Originally Posted by jaysunn View Post
Hello Peoples,

Again in my studies I have came across a cool bash trick that I tested on my Red Hat Linux Server.

For someone who does not always use the tab completion for traversing directory hierarchy. Then you may find this hack interesting.


If you edit with your favorite editor your .basrc file in your home directory. You can add this text to the file to assist you with misspelled directory changes. Have a look:


First edit your .bashrc file in the home directory.

Code:
[root@radio5 ~]# vi ~/.bashrc

You shouldn't assume that a person will use vi. Use the $VISUAL or
$EDITOR variable:

Code:
${VISUAL:-${EDITOR:-nano}} ~/.bashrc
Quote:
Now add the following to the file.

Code:
shopt -s cdspell
Now logout and log back in. And check if it is working by miss typing a directory change.

There's no need to log out.

Either source ~/.bashrc or execute the same command in the current shell.
Quote:
Code:
[root@radio5 ~]# cd /var/lg
/var/log
[root@radio5 log]#
As you can see I tried to type cd /var/log however I miss typed /var/lg missing the o.

Bash automatically spits out the correct path.

Have fun,

Jaysunn
Reply With Quote
Reply

Tags
shopt , shopt -s cdspell


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Problems with for loop( bash shell ) shell_chan Shell scripting 1 26-07-2009 05:49 PM
Bash shell date format chinalinix Shell scripting 3 20-07-2009 10:30 AM
Bash shell test vs [ vs [[ raj Shell scripting 1 11-07-2009 06:11 PM
Please suggest me this easy bash shell script nextcmchiranjeevi Shell scripting 1 11-02-2009 02:34 AM
How can I set Path in bash shell chanderbio Shell scripting 2 13-06-2008 10:38 AM


All times are GMT +5.5. The time now is 08:01 AM.


Powered by vBulletin® Version 3.8.5 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2010 nixCraft. All rights reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38