这很奇怪。我在我的.bashrc
文件中设置了shopt -s autocd
,如果我在shell中运行shopt -p
,我可以看到它是可用的(并设置)。
但是当我启动tmux shell并运行shopt -p
时,自动cd选项不再显示,任何试图移动到没有cd
命令前缀的目录的尝试都会失败,并显示一条消息说-bash: /Users/me/some/directory: is a directory
下面是shopt -p
在 tmux…
shopt -u cdable_vars
shopt -s cdspell
shopt -u checkhash
shopt -s checkwinsize
shopt -s cmdhist
shopt -u compat31
shopt -s dotglob
shopt -u execfail
shopt -s expand_aliases
shopt -u extdebug
shopt -s extglob
shopt -s extquote
shopt -s failglob
shopt -s force_fignore
shopt -s gnu_errfmt
shopt -s histappend
shopt -u histreedit
shopt -u histverify
shopt -u hostcomplete
shopt -s huponexit
shopt -s interactive_comments
shopt -u lithist
shopt -s login_shell
shopt -u mailwarn
shopt -u no_empty_cmd_completion
shopt -s nocaseglob
shopt -u nocasematch
shopt -u nullglob
shopt -s progcomp
shopt -s promptvars
shopt -u restricted_shell
shopt -u shift_verbose
shopt -s sourcepath
shopt -u xpg_echo
下面是shopt -p
在 tmux…
shopt -s autocd
shopt -u cdable_vars
shopt -s cdspell
shopt -u checkhash
shopt -u checkjobs
shopt -s checkwinsize
shopt -s cmdhist
shopt -u compat31
shopt -u compat32
shopt -u compat40
shopt -u compat41
shopt -u compat42
shopt -s complete_fullquote
shopt -u direxpand
shopt -s dirspell
shopt -s dotglob
shopt -u execfail
shopt -s expand_aliases
shopt -u extdebug
shopt -s extglob
shopt -s extquote
shopt -u failglob
shopt -s force_fignore
shopt -u globstar
shopt -u globasciiranges
shopt -s gnu_errfmt
shopt -s histappend
shopt -u histreedit
shopt -u histverify
shopt -u hostcomplete
shopt -s huponexit
shopt -s interactive_comments
shopt -u lastpipe
shopt -u lithist
shopt -s login_shell
shopt -u mailwarn
shopt -u no_empty_cmd_completion
shopt -s nocaseglob
shopt -u nocasematch
shopt -u nullglob
shopt -s progcomp
shopt -s promptvars
shopt -u restricted_shell
shopt -u shift_verbose
shopt -s sourcepath
shopt -u xpg_echo
tmux
默认为每个新窗口/窗格创建一个登录shell。这意味着执行的是.bash_profile
(也可能是.profile
或.bash_login
,取决于可用的文件),而不是.bashrc
。有关default-shell
和default-conmand
选项的信息,请参阅手册页。
(错误消息中当前shell的名称-bash
也确认您处于登录shell中,而不是常规的交互式shell。)