0

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

但是,当我启动 tmux shell 并运行shopt -pautocd 选项时,不再显示任何尝试进入没有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
4

1 回答 1

0

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

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

于 2016-10-11T11:44:56.077 回答