Math working on command line but not in script

Robert Mark Bram relaxedrob@optusnet.com.au
Tue Sep 23 05:45:00 GMT 2003


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/



More information about the Cygwin mailing list