Shopt

From Linux Shell Scripting Tutorial - A Beginner's handbook
Jump to navigation Jump to search

shopt is a shell builtin command to set and unset (remove) various Bash shell options. To see current settings, type:

shopt

Sample outputs:

autocd         	off
cdable_vars    	off
cdspell        	off
checkhash      	off
checkjobs      	off
checkwinsize   	on
cmdhist        	on
compat31       	off
compat32       	off
compat40       	off
dirspell       	off
dotglob        	off
execfail       	off
expand_aliases 	on
extdebug       	off
extglob        	on
extquote       	on
failglob       	off
force_fignore  	on
globstar       	off
gnu_errfmt     	off
histappend     	on
histreedit     	off
histverify     	off
hostcomplete   	off
huponexit      	off
interactive_comments	on
lithist        	off
login_shell    	off
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

To enable (set) option use the following command:

shopt -s optionNameHere

To disable (unset) option use the following command:

shopt -u optionNameHere

See also