delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/01/31/02:53:12

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
To: cygwin AT cygwin DOT com
From: Jani Tiainen <redetin AT luukku DOT com>
Subject: Re: Unable to properly execute a let statement from a shell script
Date: Mon, 31 Jan 2005 09:52:40 +0200
Lines: 54
Message-ID: <ctko42$4a8$1@sea.gmane.org>
References: <00b201c50767$a507e0b0$f968dc54 AT I2 DOT COM>
Mime-Version: 1.0
X-Complaints-To: usenet AT sea DOT gmane DOT org
X-Gmane-NNTP-Posting-Host: 195.236.144.25
User-Agent: Mozilla Thunderbird 0.9 (Windows/20041118)
In-Reply-To: <00b201c50767$a507e0b0$f968dc54@I2.COM>
X-Gmane-MailScanner: Found to be clean
X-Gmane-MailScanner: Found to be clean
X-Gmane-MailScanner-SpamScore: s
X-MailScanner-From: goc-cygwin AT m DOT gmane DOT org
X-IsSubscribed: yes

Paolo Gesmundo kirjoitti:
> Hi all,
> 
> I am running bash on XP
> 
> I have a very simple script a.sh
> 
> a.sh:
> 
> ====================
> export P=1
> let Q=$P+1
> echo P=$P
> echo Q=$Q
> ====================
> 
> Case 1)
> If at prompt I run:
> 
>> a.sh
> 
> let: not found
> P=1
> Q=
> 
> Case 2)
> If I run:
> 
>> bash a.sh
> 
> P=1
> Q=2
> 
> I know that I could modify a.sh by adding #!/bin/bash
> at the top of the file but I would need to avoid this
> otherwise I have to modify too many scripts
> 
> Is there a way to run a.sh like in Case 1 and get the
> proper result like in Case 2?

No. Because there is no specifiaction which shell system must use if you 
omit that from first comment line. It can use same as users, or sh, csh, 
ksh, bash or what ever it might comeup.

So you have to but it there to be sure, and by using simple script you 
can do it in a batch so there is very little manual work needed.

So, script execution (note that running script is _always_ done in new 
shell process in *nix style system) is a bit different from Windows/DOS 
batch files.

-- 

Jani Tiainen


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