shopt命令是set命令的一种替代
-p”选项来查看shopt选项的设置。“-u”开关表示一个复位的选项,“-s”表示选项当前被设置。
shopt命令选项
[root@localhost ~]# shopt -p #查看当前设置情况
shopt -u cdable_vars
shopt -u cdspell
shopt -u checkhash
shopt -s checkwinsize
shopt -s cmdhist
shopt -u dotglob
shopt -u execfail
shopt -s expand_aliases
shopt -u extdebug
shopt -u extglob
shopt -s extquote
shopt -u failglob
shopt -s force_fignore
shopt -u gnu_errfmt
shopt -u histreedit
shopt -u histappend
shopt -u histverify
shopt -s hostcomplete
shopt -u huponexit
shopt -s interactive_comments
shopt -u lithist
shopt -s login_shell
shopt -u mailwarn
shopt -u no_empty_cmd_completion
shopt -u nocaseglob
shopt -u nullglob
shopt -s progcomp
shopt -s promptvars
shopt -u restricted_shell
shopt -u shift_verbose
shopt -s sourcepath
shopt -u xpg_echo
[root@localhost ~]# shopt -s cdspell #把cdspell选项打开
[root@localhost ~]# shopt -p cdspell #打印cdspell设置
shopt -s cdspell
[root@localhost ~]# cd /raot #故意拼写错误
/root
[root@localhost ~]# pwd #查看当前目录
/root
[root@localhost ~]# cd /usr/loca/bin #故意拼写错误
/usr/local/bin
[root@localhost bin]# pwd #查看当前目录
/usr/local/bin
[root@localhost bin]# shopt -u cdspell #把cdspell选项打开
[root@localhost bin]# shopt -p cdspell #打印cdspell设置
shopt -u cdspell
[root@localhost bin]# cd /raot #故意拼写错误
-bash: cd: /raot: 没有那个文件或目录 #进入目录错误