This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
Math working on command line but not in script
- From: "Robert Mark Bram" <relaxedrob at optusnet dot com dot au>
- To: "Cygwin" <cygwin at cygwin dot com>
- Date: Tue, 23 Sep 2003 15:41:51 +1000
- Subject: Math working on command line but not in script
- Reply-to: <Robert dot Bram at infotech dot monash dot edu dot au>
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/