【发布时间】:2013-04-30 21:59:42
【问题描述】:
我很难理解我的 ubuntu 的 .bashrc 中写的内容,如下所示。
这是我不明白的:
大括号和
-/+符号在:之后的用途是什么? (例如:${debian_chroot:-} 和 ${debian_chroot:+($debian_chroot)})eval命令。-
以下 sn-p 代码的工作原理。
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then debian_chroot=$(cat /etc/debian_chroot) fi if [ "$color_prompt" = yes ]; then PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' else PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' fi
【问题讨论】:
标签: bash eval curly-braces