1

首先是问题: mc 的子shell 与父shell 和我的tcsh 环境相比有不同的提示。所有其他设置/变量/别名都在 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 的子外壳中即时更改提示确实暂时有效。看来,提示字符串本身是可以理解的。

有人有想法吗?

4

2 回答 2

1

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

于 2019-10-29T19:44:43.050 回答
0

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;
于 2020-01-12T13:56:50.960 回答