我想让我的Shell提示符看起来像一个芝士汉堡!
如果它还能显示用户名、主机名和当前目录就更好了。
如果它还能显示用户名、主机名和当前目录就更好了。
$ sudo apt-get install ttf-ancient-fonts
$ export PS1="\\u@\h \\w "
在Linux系统中的任何地方输入一个芝士汉堡:
u
xterm
会显示一个小框,让我输入Unicode字符,但只限于“可打印”范围内。 - 0x2b3bfa0我情不自禁地可能过了头。此版本会根据时间显示不同的字符,以说明您应该在那个时候做什么。
declare -A pp
pp=(["09"]="" ["07"]="" ["08"]="" [10]="" [11]="" [12]="" [13]="" [14]="" [15]="" [16]="" [17]="" [18]="" [19]="" [20]="" [24]="")
u_pp() {
c=${pp[`date +"%H"`]}
if [[ $c == "" ]]; then
c=${pp[24]}
fi
PS1='\u@\h:\w${c} '
};
u_pp
export PROMPT_COMMAND="u_pp;"
PS1
的赋值:PS1='[\@] \u@\h:\w${c} '
askubuntu
中被问到的最愚蠢的问题,但我只是想知道你是否有办法在mac
上使其工作,因为当我将其添加到我的(mac)~/.bash_profile时,我得到了“no matches found: [9]=” 的错误提示 :) - sameera207export PS1="\\u@\h \\w (||]"
vim ~/.bashrc
export PS1="\[\e[01;37m\][\[\e[0m\]\[\e[01;32m\]\u\[\e[0m\]\[\e[00;37m\]@\[\e[0m\]\[\e[01;34m\]\h\[\e[0m\]\[\e[00;37m\] \[\e[0m\]\[\e[00;37m\]\t\[\e[0m\]\[\e[01;37m\] \W \e[1;37m(\e[1;32m|\e[1;33m|\e[1;31m|\e[1;37m]\\$ \[\e[0m\]"
结果(无颜色):
[john@server003 15:39:14 ~ (|||]$
export PS1='\[\e[1;32m\][\u@\h \W]\ \[\e[0m\] '
export PS1='\[\e[1;31m\][\u@\h \W]\ \[\e[0m\] '
export PS1="\\u@\h \\w "
或者
export PS1="\\u@\h \\w "
爱心:
export PS1="\\u@\h \\w "
export PS1="[\@] \u@\h "
printf
和命令替换一起使用:$ PS1='$(printf "\U0001f354") $ '
$ echo "Hello,my cheesy prompt!"
Hello,my cheesy prompt!
$
ttf-ancient-fonts
软件包的一部分。 - cjmtff-ancient-fonts
后,这个问题看起来好多了。 - Thomas