How to change shell prompt in Unix?

我与影子孤独终老i 提交于 2019-12-12 06:58:40

问题


I want to disable the Unix shell prompt character ($, #, %) which usually we see in terminal. Is there any command or setting which can do this? I am using Solaris OS.

By shell prompt character I mean:

>$
>#

回答1:


You need to adjust your PS1 environment variable in your .profile file. I guess you could set it to "" to have it empty.

ex: export PS1=""

EDIT: it can also be in your .bashrc file, or any other shell you are using.




回答2:


You can get fancy and put the host name in there. But basically you change the PS1 environment variable:

export PS1=hello

You can add this command in your ~/.bashrc file. Or other startup file, if you use another shell.




回答3:


I suggest first check the man pages for the shell (whatever is yours? echo $SHELL) under shell variables. There are four types of prompt strings(PS) PS1, PS2, PS3, PS4, for your problem PS1 adjustment is sufficient. To check the current settings: echo $PS1

To change: PS1="" for the current session, to make it permanent export it in your ~/.bashrc or ~/.profile.

To make it permanent for the user: export PS1="whatever special characters you want"

for more special characters and examples you can visit here "http://linuxconfig.org/bash-prompt-basics"



来源:https://stackoverflow.com/questions/26410215/how-to-change-shell-prompt-in-unix

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!