delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/10/02/05:27:35

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Originating-IP: [62.221.7.122]
From: "Nrusinh Ambekar" <nrusinh AT hotmail DOT com>
To: cygwin AT cygwin DOT com
Subject: problem - if statement in shell script gives opposite results with new bash
Date: Wed, 02 Oct 2002 09:27:23 +0000
Mime-Version: 1.0
Message-ID: <F139NIJWNDIT6bB5Rw100000304@hotmail.com>
X-OriginalArrivalTime: 02 Oct 2002 09:27:23.0834 (UTC) FILETIME=[EA48D1A0:01C269F5]

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019