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

前端之家收集整理的这篇文章主要介绍了在OSX终端中修改bash提示符前缀[已关闭]前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个巨大的提示将我的终端的空间“名称 – MacBook-Pro”在同一行上,每行输入命令。

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

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

检查它当前设置为什么@H_502_2@

echo $PS1

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

export PS1="$"

从你的dotfiles重新设置@H_502_2@

source ~/.bash_profile

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

提示变量@H_502_2@

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 +

句法@H_502_2@

\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 shell’s terminal device name
\n : newline
\r : carriage return
\s : the name of the shell,the basename of $0 (the portion following the final slash)
\t : the current time in 24-hour HH:MM:SS format
\T : the current time in 12-hour HH:MM:SS format
\@ : the current time in 12-hour am/pm format
\A : the current time in 24-hour HH:MM format
\u : the username of the current user
\v : the version of bash (e.g.,2.00)
\V : the release of bash,version + patch level (e.g.,2.00.0)
\w : the current working directory,with $HOME abbreviated with a tilde
\W : the basename of the current working directory,with $HOME abbreviated with a tilde
\! : the history number of this command
\# : the command number of this command
\$ : if the effective UID is 0,a #,otherwise a $
\nnn : the character corresponding to the octal number nnn
\\ : a backslash
\[ : begin a sequence of non-printing characters,which could be used to embed a terminal control sequence into the prompt
\] : end a sequence of non-printing characters
原文链接:https://www.f2er.com/bash/388399.html

猜你在找的Bash相关文章