[ BASICS.BASH.SHOPT ]
SHOPT
shell option
builtin command to set and unset (REMOVE) Bash shell options
# Set option
shopt -s optionNameHere
# Unset option
shopt -u optionNameHere
# Current options
shopt
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
----------------------------------
# example
When extdebug is enabled, array BASH_ARGV contains a function to reverse order all positional parameters.
array=(1 2 3 4 5 6 7 8 9 a b c d e f)
f() { array=("${BASH_ARGV[@]}"); }
shopt -s extdebug
f "${array[@]}"
shopt -u extdebug
echo "${array[@]}"
No comments:
Post a Comment