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 Message-ID: <42E4DB17.9030101@byu.net> Date: Mon, 25 Jul 2005 06:29:11 -0600 From: Eric Blake User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) MIME-Version: 1.0 To: Marek CC: cygwin AT cygwin DOT com Subject: Re: Problem with shell script References: <20050724191302 DOT 58251D10DB AT rekin6 DOT o2 DOT pl> In-Reply-To: <20050724191302.58251D10DB@rekin6.o2.pl> Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Marek on 7/24/2005 1:13 PM: > When I put commands below in command line: > i=1 > echo $i > i=$(($i+1)) > echo $i > > everything works well (i is incremented from 1 to 2), but when I run this as a shell script the result is: > 1+1 instead of 2 > > How should I do incrementation in shell script? It depends on what shell you are using. Following these directions: > Problem reports: http://cygwin.com/problems.html will give me a better idea what version of /bin/sh you have, and you should also say whether you are using a #! line at the start of your attempted script. Bash can do arithmetic expansion as required by POSIX, ash cannot. - -- Life is short - so eat dessert first! Eric Blake ebb9 AT byu DOT net volunteer cygwin bash maintainer -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFC5NsX84KuGfSFAYARAt3ZAKCSy1jtaR3ZI0Ex66LwfLSY0qvulwCglADl ROVzSiFB9eFVH6RA6+uzzGc= =r5PS -----END PGP SIGNATURE----- -- 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/