This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
problem - if statement in shell script gives opposite results with new bash
- From: "Nrusinh Ambekar" <nrusinh at hotmail dot com>
- To: cygwin at cygwin dot com
- Date: Wed, 02 Oct 2002 09:27:23 +0000
- Subject: problem - if statement in shell script gives opposite results with new bash
- Bcc:
Hi,
I have recently downloaded new cygwin. I am getting incorrect results when I
run simple shell script using bash. The same shell script runs fine with old
cygwin bash.
Your help is really appreciated.
thanks,
Nrusinh
The script is as follows
#!/usr/local/bin/bash
myfunc()
{
local item=$1
shift 1
local list=" $* "
echo "item is"
echo $item
echo "list is"
echo $list
if [ "${item}" = "${list}" ] || [ "${list#"* ${item} *"}" != "${list}" ] ||
[
"${list#"${item} "}" != "${list}" ] || [ "${list%" ${item}"}" != "${list}" ]
then
echo "found"
else
echo "not found"
fi
}
myfunc CECA OTA OEA CECA
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/