Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Aug 2001 17:03:05 -0700 (PDT)
From:      Linh Pham <lplist@closedsrc.org>
To:        Drew Tomlinson <drewt@writeme.com>
Cc:        'parv' <parv_@yahoo.com>, "'FreeBSD Questions (E-mail)'" <freebsd-questions@FreeBSD.org>
Subject:   RE: Shell Script Help - Comparing Strings
Message-ID:  <Pine.BSF.4.33.0108141702010.29278-100000@q.closedsrc.org>
In-Reply-To: <5CD46247635BD511B6B100A0CC3F023925A06B@ldcmsx01.lc.ca.gov>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2001-08-14, Drew Tomlinson scribbled:

# I see but this didn't work for me either.  This is what I get.
#
# if [ "$1"=="" ] #Tried with both single and double "="
#   then $1="www"
# fi
# + [ test== ]
# + test=www
# test=www: not found

Here's something that I scratched out in Emacs:

lpham@dnscache:/home/lpham --> cat test.sh
#!/bin/sh

test=foo

if [ $test=="" ]
then
    echo "nothing"
fi
lpham@dnscache:/home/lpham --> sh test.sh
nothing

Try removing the quotes around $1.

-- 
Linh Pham
[lplist@closedsrc.org]

// 404b - Brain not found


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?Pine.BSF.4.33.0108141702010.29278-100000>