shopt
Tomorrow I will shop. Yesterday I shopt.
No,not really. The term "shopt" is a Linux Bash thing. If you don't care about bash, stop reading now. If you find the command line interesting or useful and don't know about shopt, this is your lucky day.
Look at the word for a moment and try to figure it out:
shopt
Obviously, the etymology of the term is sh and opt. Sh is for shell, opt is for option. So this is about shell options. Shopt is a bash built-in to control options. Just so you know set is another built-in to control options.
You can check the shopt man page for more details. Simply put, shop "sets" commands with the -s switch, and unsets them with the -u switch.
shopt or shopt -p will list all the possible settings. It is a long list.
Here are a few examples.
To have the history file for bash commands appended to rather than overwritten, which could be useful, use
shopt -s histappend
Specifying things like directories in cd or ls commands has to be exact. In this day and age of google searching and autocorrect you would think there would be a way to correct spelling at the command line...
Hey, wait a minute, try:
shopt -s cdspell
That turns on spell checking for cd commands.
Glob is the convention for using patterns in path and file names. shopt lets you change the behavior of glob. Use grep to grok the glob ops in shopt
shopt -p | grep glob
That will give you a clue, and you can play around with it.
If you have aliases in use you may know that they will not be expanded in non-interactive settings. Shopt has an option for that.
Most shopt options are probably not of much use to you, but there are many so you should check them out. How many are there? This many:
shopt -p | wc -l
Enjoy
from ScienceBlogs http://ift.tt/1U1DfoA
shopt
Tomorrow I will shop. Yesterday I shopt.
No,not really. The term "shopt" is a Linux Bash thing. If you don't care about bash, stop reading now. If you find the command line interesting or useful and don't know about shopt, this is your lucky day.
Look at the word for a moment and try to figure it out:
shopt
Obviously, the etymology of the term is sh and opt. Sh is for shell, opt is for option. So this is about shell options. Shopt is a bash built-in to control options. Just so you know set is another built-in to control options.
You can check the shopt man page for more details. Simply put, shop "sets" commands with the -s switch, and unsets them with the -u switch.
shopt or shopt -p will list all the possible settings. It is a long list.
Here are a few examples.
To have the history file for bash commands appended to rather than overwritten, which could be useful, use
shopt -s histappend
Specifying things like directories in cd or ls commands has to be exact. In this day and age of google searching and autocorrect you would think there would be a way to correct spelling at the command line...
Hey, wait a minute, try:
shopt -s cdspell
That turns on spell checking for cd commands.
Glob is the convention for using patterns in path and file names. shopt lets you change the behavior of glob. Use grep to grok the glob ops in shopt
shopt -p | grep glob
That will give you a clue, and you can play around with it.
If you have aliases in use you may know that they will not be expanded in non-interactive settings. Shopt has an option for that.
Most shopt options are probably not of much use to you, but there are many so you should check them out. How many are there? This many:
shopt -p | wc -l
Enjoy
from ScienceBlogs http://ift.tt/1U1DfoA
Aucun commentaire:
Enregistrer un commentaire