How do I change the command line default prompt λ for bash? 如何更改 bash 的命令行默认提示符 λ ? #2919
Unanswered
DOSforever
asked this question in
Q&A
Replies: 1 comment
-
You can indeed write custom config *.sh scripts in |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
根据 https://github.com/cmderdev/cmder#changing-cmder-default-cmdexe-prompt-config-file 页面上的说明,只有更改 CMD 环境命令提示符的方法,但没有更改 bash 环境下命令提示符的方法,我后来自己找到了是在
$CMDER_ROOT/vendor/git-for-windows/etc/profile.d/git-prompt.sh
文件中更改,但根据 https://github.com/cmderdev/cmder#upgrading 的说明,升级后我所做的修改将被删除,并且那么在 [cmder_root]/config 目录中修改哪个文件是可以改变 bash 的默认命令提示符的呢?或许在 [cmder_root]/config/profile.d 目录中我可以自己单独写一个 shell script 文件来更改提示符,但对我这个不熟悉 bash shell 的人来说这有些困难,所以最好有个现成的文件来修改。
另外在此问题上的一个扩展问题:如何根据启动 bash 的状态来自动设定命令提示符?如果以非管理员模式启动则显示
$
,如果以管理员模式启动则显示#
。translated by machine
According to the instructions on the https://github.com/cmderdev/cmder#changing-cmder-default-cmdexe-prompt-config-file page, there is only a way to change the command prompt in the CMD environment, but there is no way to change the command prompt in the bash environment. I found it myself in
$CMDER_ROOT/vendor/git-for-windows/etc/profile.d/git-prompt.sh
, but according to https://github.com/cmderdev/cmder#upgrading, the changes I made will be deleted after the upgrade and the command prompt will be deleted. The changes I made will be deleted after the upgrade, andSo which file in the [cmder_root]/config directory can be changed to change bash's default command prompt? I could probably write my own shell script file in the [cmder_root]/config/profile.d directory to change the prompt, but that's a bit difficult for someone unfamiliar with the bash shell, so it's better to have a ready-made file to change.
An extension to this question: how to automatically set the command prompt according to the state in which bash is started? If started in non-administrator mode it shows
$
, if started in administrator mode it shows#
.Beta Was this translation helpful? Give feedback.
All reactions