[plug] How to check for an empty string in a bash script.
Buddrige, David
david.buddrige at mitswa.com.au
Wed Dec 15 11:03:49 WST 1999
thanks heaps Tony... 8-)
regards
David.
-----Original Message-----
From: Anthony J. Breeds-Taurima [mailto:tony at cantech.net.au]
Sent: Wednesday, 15 December 1999 10:57
To: 'plug at linux.org.au'
Subject: Re: [plug] How to check for an empty string in a bash script.
On Wed, 15 Dec 1999, Buddrige, David wrote:
> Hi all,
>
> I have the following code in a bash script that I am writing...
>
> if [ THE_PATH="" ]; then
> echo "The Path is:" $THE_PATH
> echo "FAIL! FILE DOES NOT EXIST."
> fi
if [ -n "$THE_PATH" ] ; then
echo the path contains data
fi
if [ -z "$THE_PATH" ] ; then
echo the path is empty
fi
Yours Tony.
More information about the plug
mailing list