shopt为bash shell 的一个 builtin(内置)命令, 功能为获取当前shell option
如:
不加任何选项可获取当前选项
[Bash shell] 纯文本查看 复制代码 [iyunv@elk ~]# 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 off
histreedit off
histverify off
hostcomplete off
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
[Bash shell] 纯文本查看 复制代码 [iyunv@elk ~]# shopt -u cdspell #unset
[iyunv@elk ~]# shopt -q cdspell && echo 1 || echo 0
0
[iyunv@elk ~]# shopt -s cdspell # set
[iyunv@elk ~]# shopt -q cdspell && echo 1 || echo 0
1
更多shopt 与 set 的区别请移步Bash 为何要发明 shopt 命令
|