This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

problem - if statement in shell script gives opposite results with new bash


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]