delorie.com/archives/browse.cgi | search |
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 |
Reply-To: | <Robert DOT Bram AT infotech DOT monash DOT edu DOT au> |
From: | "Robert Mark Bram" <relaxedrob AT optusnet DOT com DOT au> |
To: | "Cygwin" <cygwin AT cygwin DOT com> |
Subject: | Math working on command line but not in script |
Date: | Tue, 23 Sep 2003 15:41:51 +1000 |
Message-ID: | <DDEDIPLLKIAMLBCBFCHECEDGCPAA.relaxedrob@optusnet.com.au> |
MIME-Version: | 1.0 |
X-Priority: | 3 (Normal) |
X-MSMail-Priority: | Normal |
Importance: | Normal |
X-MimeOLE: | Produced By Microsoft MimeOLE V6.00.2800.1165 |
Howdy All! I have a small script called maths.sh with the following code in it: #/usr/bin/bash count=0 echo $count count=$(( $count + 1 )) echo $count count=$(( $count + 1 )) echo $count count=$(( $count + 1 )) echo $count count=$(( $count + 1 )) echo $count When I run the instructions directly on the command line it works ok but when I run the script, it fails, as you can see from the following screen dump: $ count=0 $ echo $count 0 $ count=$(( $count + 1 )) $ echo $count 1 $ count=$(( $count + 1 )) $ echo $count 2 $ count=$(( $count + 1 )) $ echo $count 3 $ count=$(( $count + 1 )) $ echo $count 4 $ ./math.sh 0 ? 0 + 1 ? ? ? 0 + 1 ? + 1 ? ? ? ? 0 + 1 ? + 1 ? + 1 ? ? ? ? ? 0 + 1 ? + 1 ? + 1 ? + 1 ? $ Can anyone tell me what is going wrong? Any advice would be most appreciated! Rob :) :-> :-} -- 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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |