Well, its really a kool little tool.
Lets say you want to use "EXCLUDE MATCHES" in a cp or ls commend. Turn on extglob and have fun:
WITH OUT extblog on
! shopt extglob
extglob off
! ls
a.txt ab.txt abacab.txt abc.txt abcab.txt acab.txt c.txt ca.txt cab.txt
TURN extblog on
! ls
a.txt ab.txt abacab.txt abc.txt abcab.txt acab.txt c.txt ca.txt cab.txt
WITH extblog on
! shopt -s extglob
! ls !(a*)
c.txt ca.txt cab.txt
Now let's say operate in multiple shells and like to append your history so all is persistent!
Set it from .bashrc
! shopt -s histappend
Got your shell screaming about your mail?
# Disable options:! shopt -u mailwarn ! unset MAILCHECK
NOTE: ALL shopt an be set with -s switch and unset with the -u switch.
Read up and enjoy!
All these wonderful options:
cdable_vars off
cdspell off
checkhash off
checkwinsize on
cmdhist on
dotglob off
execfail off
expand_aliases on
extdebug off
extglob off
extquote on
failglob off
force_fignore on
gnu_errfmt off
histappend off
histreedit off
histverify off
hostcomplete on
huponexit off
interactive_comments on
lithist off
login_shell on
mailwarn off
no_empty_cmd_completion off
nocaseglob off
nocasematch off
nullglob off
progcomp on
promptvars on
restricted_shell off
shift_verbose off
sourcepath on
xpg_echo off
tags: shopt mailwarn linux osx history cdable_vars cdspell checkhash checkwinsize cmdhist dotglob execfail expand_aliases extdebug extglob extquote failglob force_fignore gnu_errfmt histappend histreedit histverify hostcomplete huponexit interactive_commen
links: digg this del.icio.us technorati reddit