如何避免在Bash提示中出现波浪号〜?
我想从显示在PS1变量中的波浪号中删除。 我当前的PS1字符串: PS1="\h:\w\n$" 提示如下: lnx-hladky:/tmp/plugtmp $ 我不喜欢$ HOME目录显示为波浪号。可以避免吗? 它会引起问题,例如: lnx-hladky:~/DOC $ 文档说: \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 有没有可能避免$ HOME用代字号缩写? 我找到了一种解决方法,但是我觉得它太复杂了: PROMPT_COMMAND='echo -ne "\e[4;35m$(date +%T)\e[24m$(whoami)@$(hostname):$(pwd)\e[m\n"' PS1=$ 谁能提出更好的解决方案?我觉得运行这么多命令只是为了获得提示并不是很好。(日期,whoami,主机名,pwd)。