Skip site navigation (1)Skip section navigation (2)
Date:      12 Apr 1998 23:36:31 -0500
From:      sfarrell+lists@farrell.org
To:        Dean Hollister <dean@odyssey.apana.org.au>
Cc:        FreeBSD Questions <freebsd-questions@FreeBSD.ORG>
Subject:   Re: bash: checking for empty string?
Message-ID:  <87k98ugwxc.fsf@phaedrus.uchicago.edu>
In-Reply-To: Dean Hollister's message of "Mon, 13 Apr 1998 10:50:47 %2B0800 (WST)"
References:  <Pine.BSF.3.96.980413104954.2098A-100000@odyssey.apana.org.au>

next in thread | previous in thread | raw e-mail | index | archive | help
Dean Hollister <dean@odyssey.apana.org.au> writes:

> If have a string $name. I need to check if this is blank, and if it
> is, exit the script. Any ideas?

man test(1)
man [

so, for example

if [ -z "$SOMEVAR" ]; then
	echo "SOMEVAR is undefined!"
	exit 1
fi

--

Steve Farrell


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?87k98ugwxc.fsf>