英文:
The hostname and current work path is not displayed in Linux terminal
问题
我在我的Linux机器上激活了某些东西,导致屏幕只显示(base)
而不是(base) [user@host path]$
。当我取消激活它时,屏幕仍然是空白的,这不正常。我想恢复正常的屏幕。我已经搜索了解决方案,但没有找到有用的内容。我不确定这个问题与什么相关,所以无法搜索相关的关键词。我该如何修复这个问题?
当前屏幕:
(base) python foo.py
期望的屏幕:
(base) [user@host path]$ python foo.py
英文:
I have activated something on my Linux machine which caused the screen to only display (base)
instead of (base) [user@host path]$
. When I deactivate it, the screen remains blank which is not normal. I want to restore the normal screen. I have searched for solutions but haven't found anything helpful. I am not sure what this issue is related to so I am not able to search for relevant keywords. How can I fix this?
Current screen:
(base) python foo.py
Desired screen:
(base) [user@host path]$ python foo.py
答案1
得分: 0
你需要查找在你所引用的shell脚本中重载了你的提示符(shell variable)的位置。通常这个变量的名称是$PS1。
你可以使用以下方式查看其定义:
echo $PS1
并且你可以使用以下方式修改它:
export PS1="[\u@\h: \w/]$ " # 例如
类似的问题:https://stackoverflow.com/questions/71910898/full-file-path-on-bash-prompt。
英文:
You have to look for the place where your prompt shell variable is overloaded in the shell script that you sourced. The variable name is usually $PS1.
You can see its definition using :
echo $PS1
And you can modify it using :
export PS1="[\u@\h: \w/]$" # for example
Similar question: https://stackoverflow.com/questions/71910898/full-file-path-on-bash-prompt .
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论