加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

在OSX终端中修改bash提示符前缀[已关闭]

发布时间:2020-12-15 19:41:08 所属栏目:安全 来源:网络整理
导读:我有一个巨大的提示将我的终端的空间“名称 – MacBook-Pro”在同一行上,每行输入命令。 有没有办法我可以删除这个或缩短? 您的提示由环境变量PS1设置。这是由/ private / etc / bashrc中的系统设置的,但通常由用户在您的主目录中的dotfiles中进行修改。
我有一个巨大的提示将我的终端的空间“名称 – MacBook-Pro”在同一行上,每行输入命令。

有没有办法我可以删除这个或缩短?

您的提示由环境变量PS1设置。这是由/ private / etc / bashrc中的系统设置的,但通常由用户在您的主目录中的dotfiles中进行修改。

检查它当前设置为什么

echo $PS1

通过设置?/ .bash_profile中的变量或者以前定义的变量来修改它。

export PS1="$"

从你的dotfiles重新设置

source ~/.bash_profile

这将使您的新shell提示只需一个$

提示变量

PS1 : primary prompt string. The default value is s-v$ .
PS2 : secondary prompt string. The default is >
PS3 : prompt for the select command
PS4 : printed before each command bash displays during an execution trace. The first character of PS4 is replicated multiple times,as necessary,to indicate multiple levels of indirection. The default is +

句法

a : an ASCII bell character (07)
d : the date in “Weekday Month Date” format (e.g.,“Tue May 26”)
D{format} :    the format is passed to strftime(3) and the result is inserted into the prompt string; an empty format results in a locale-specific time representation. The braces are required
e : an ASCII escape character (033)
h : the hostname up to the first ‘.’
H : the hostname
j : the number of jobs currently managed by the shell
l : the basename of the shella                        

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读