delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/04/13/03:35:58

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
X-eSCM-MailFrom: <andre AT dieball DOT net>
Subject: RE: Variable not set correctly in bash
MIME-Version: 1.0
Date: Wed, 13 Apr 2005 09:22:31 +0200
Message-ID: <86B406A17C3F684CB66499B87361FB3802D8FE@mail.dieball.net>
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
From: "Andre Dieball" <andre AT dieball DOT net>
To: <cygwin AT cygwin DOT com>
X-IsSubscribed: yes
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id j3D7Zlmp003199

Hello Brian

Thanks for the hint. In fact, I'm calling explicit bash with
"#!/bin/bash" in the scripts.
I'll try you're workaround anyway as soon as I come home.

Thanks.

Andre

-----Original Message-----
From: cygwin-owner AT cygwin DOT com [mailto:cygwin-owner AT cygwin DOT com] On Behalf
Of Brian Dessent
Sent: Mittwoch, 13. April 2005 08:03
To: cygwin AT cygwin DOT com
Subject: Re: Variable not set correctly in bash

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/






--
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