I'm looking at the source code of virtualenv, and the activate script contains this code:
if [ -z "$VIRTUAL_ENV_DISABLE_PROMPT" ] ; then
_OLD_VIRTUAL_PS1="$PS1"
if [ "x" != x ] ; then
PS1="$PS1"
else
if [ "`basename \"$VIRTUAL_ENV\"`" = "__" ] ; then
# special case for Aspen magic directories
# see http://www.zetadev.com/software/aspen/
PS1="[`basename \`dirname \"$VIRTUAL_ENV\"\``] $PS1"
else
PS1="(`basename \"$VIRTUAL_ENV\"`)$PS1"
fi
fi
export PS1
fi
What does the line if [ "x" != x ]
do? x is not defined anywhere else in the script.
In Bash, that test is guaranteed to fail; [ "x" != x ]
always returns a non-zero exit status (i.e. "false"), because "x"
and x
are both the string consisting of the single character x
. (The quotation marks don't really have any effect in this case.)
What's more, the command PS1="$PS1"
doesn't really do anything, either: it just sets the variable PS1
equal to the value it already has.
I'm guessing that this script is autogenerated in some way, and that on some systems, these statements will look a bit different, and a bit less useless.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With