Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 May 2002 12:41:10 -0400 (EDT)
From:      "C J Michaels" <cjm2@earthling.net>
To:        <liuchao@atm.mdc.tsinghua.edu.cn>
Cc:        <freebsd-questions@freebsd.org>
Subject:   Re: What's the 'X' means in the shell test: if [ 'X${SNAPDATE}' != 'X' ];
Message-ID:  <1818.216.153.202.55.1021653670.squirrel@www.27in.tv>
In-Reply-To: <001101c1fd4d$00255400$4e406fa6@mountain>
References:  <001101c1fd4d$00255400$4e406fa6@mountain>

next in thread | previous in thread | raw e-mail | index | archive | help
It's doesn't mean anything.  It's a way of testing for a null value w/o
actually have a null if your if statement.
liuc said:
>
> TYPE="FreeBSD"
> REVISION="3.3"
> BRANCH="RELEASE"
> RELEASE="${REVISION}-${BRANCH}"
> SNAPDATE=""
> if [ "X${SNAPDATE}" != "X" ]; then

If $SNAPDATE isn't set, this will effectively be testing if [ "X" != "X"
].  I don't believe if [ "${SNAPDATE}" != "" ] works in all situations.
> RELEASE="${RELEASE}-${SNAPDATE}"
> fi
> VERSION="${TYPE} ${RELEASE}"
>
> if [ "X${PARAMFILE}" != "X" ]; then
> RELDATE=$(awk '/__FreeBSD_version.*propagated to newvers/ {print $3}'
> \
>  ${PARAMFILE})
> else
> RELDATE=$(awk '/__FreeBSD_version.*propagated to newvers/ {print $3}'
> \
>  $(dirname $0)/../sys/param.h)
> fi


-- 
Chris

"I'll defend to the death your right to say that, but I never said I'd
listen to it!"     -- Tom Galloway with apologies to Voltaire



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1818.216.153.202.55.1021653670.squirrel>