【发布时间】:2014-07-15 18:15:19
【问题描述】:
基于 Debian 的系统的默认 .bashrc 文件设置 $PS1 如下:
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
让我感到困惑的是${debian_chroot} 部分。根据StackOverflow: Difference between single and double quotes in bash,如果在定义字符串时使用单引号,则应将$ 等字符视为文字,而不是评估变量。
这是否意味着 Bash 应该实际上打印出${debian_chroot:...,而不是那个变量的值?还是这里涉及到更多的语法规则?
【问题讨论】: