delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/04/13/02:01:22

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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
Message-ID: <425CB62C.FAF6F5B6@dessent.net>
Date: Tue, 12 Apr 2005 23:03:24 -0700
From: Brian Dessent <brian AT dessent DOT net>
Organization: My own little world...
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Variable not set correctly in bash
References: <86B406A17C3F684CB66499B87361FB3802D8FD AT mail DOT dieball DOT net>
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com

Andre Dieball wrote:

>                 NEW=$[ $OLD + 1 ]

That construct is a bash extension that is not part of the regular
bourne shell capability.  On linux, /bin/sh is bash, so it works.  On
Cygwin, /bin/sh is ash which is a more basic bourne shell that does not
have all the extra extensions that bash has.  In other words, by doing
that you're limiting your script to only work on bash.  You can either
change the shebang to explicitly call bash, or use a more portable
construct, such as

NEW=`expr $OLD + 1`

Brian

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.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