在tmux里面,shopt -s autocd丢失了?

时间:2016-10-11 09:38:26

标签: bash shell

这很奇怪。我在shopt -s autocd文件中设置了.bashrc,如果我在我的shell中运行shopt -p,我可以看到它可用(并设置)。

但是当我启动tmux shell并运行shopt -p时,不再显示autocd选项,并且任何尝试只是在没有cd命令前缀的情况下进入目录将会失败并显示一条消息说-bash: /Users/me/some/directory: is a directory

以下是 tmux ...

shopt -p 的输出
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

1 个答案:

答案 0 :(得分:0)

tmux默认为每个新窗口/窗格创建一个登录shell。这意味着执行.bash_profile(或可能.profile.bash_login,具体取决于可用文件),而不是.bashrc。有关default-shelldefault-conmand选项的信息,请参见手册页。

(错误消息-bash中的当前shell的名称,也确认您位于登录shell中,而不是常规交互式shell。)