Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , 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: From: "Robert Mark Bram" To: "Cygwin" Subject: Math working on command line but not in script Date: Tue, 23 Sep 2003 15:41:51 +1000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit 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/