【问题标题】:Prompt is different in midnight-commander (mc) subshell午夜指挥官 (mc) 子外壳中的提示不同
【发布时间】:2020-02-22 00:14:00
【问题描述】:

问题第一: 与父 shell 和我的 tcsh 环境相比, mc 的子 shell 有不同的提示。所有其他设置/变量/别名在 mc 的子外壳中都可用,只是提示似乎没有正确“通过”。我不知道为什么会这样。 手册页说:

An  extra  added  feature  of using the subshell is that the prompt displayed by the Midnight Commander is the same prompt that you are currently using in your shell.

背景: 我正在使用我自己在本地安装的 mc.4.8.23(因为没有 root 权限)。基本上完成了这两个步骤:

./configure --prefix=<absolute path>/eda_tools/mc/mc-4.8.23/install --bindir=<absolute path>/eda_tools/mc/mc-4.8.23/bin --with-screen=ncurses
make install

mc 的其余部分工作正常。

到目前为止我所做的尝试:

  • 将测试提示和测试别名放入 ~/.config/mc & ~/.mc & ~/.local/share/mc 内的 tcshrc。 这些位置似乎都没有在 mc 启动时进行评估。我既看不到更改的提示,也看不到测试别名。
  • 已将 .cshrc 中的提示暂时更改为非常简单的提示。 没有帮助。
  • 在 mc 的子 shell 中即时更改提示确实暂时有效。看来,提示字符串本身是可以理解的。

有人有想法吗?

【问题讨论】:

    标签: prompt tcsh mc


    【解决方案1】:

    tcsh 的提示被硬编码在源文件src/subshell/common.c 的函数init_subshell_precmd 中。为了让你的提示重新编译 mc 并应用此补丁:

    --- src/subshell/common.c.org   2019-06-16 19:49:31.041841616 +0200
    +++ src/subshell/common.c       2020-01-12 14:17:03.928956667 +0100
    @@ -886,7 +886,6 @@
         case SHELL_TCSH:
             g_snprintf (precmd, buff_size,
                         "set echo_style=both; "
    -                    "set prompt='%%n@%%m:%%~%%# '; "
                         "alias precmd 'echo $cwd:q >>%s; kill -STOP $$'\n", tcsh_fi
             break;
    

    【讨论】:

      【解决方案2】:

      尝试将带有提示设置的 tcshrc 放在 ~/.local/share/mc/ 目录中。 我无法使用 tcsh 进行验证,但这个位置对于 mc 中的 bash 子shell 肯定有效(使用 bashrc)。

      【讨论】:

      • 非常感谢您的建议。其实我已经试过了。你看不到,因为我的描述是错误的。出现复制和粘贴错误(~/.config/mc 存在两次)。我现在已经更正了。对不起。
      猜你喜欢
      • 2017-01-06
      • 2012-03-16
      • 2015-03-28
      • 2016-01-01
      • 2013-01-26
      • 1970-01-01
      • 2016-12-25
      • 2013-02-04
      • 1970-01-01
      相关资源
      最近更新 更多