delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/05/13/08:47:17

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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
Message-ID: <4284A1A2.6060306@byu.net>
Date: Fri, 13 May 2005 06:46:26 -0600
From: Eric Blake <ebb9 AT byu DOT net>
User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)
MIME-Version: 1.0
To: Pekka Niiranen <pekka DOT niiranen AT wlanmail DOT com>
CC: cygwin AT cygwin DOT com
Subject: Re: SOLUTION: Strange behaviour with output redirection (MORE information, Bug in awk.exe?)
References: <d5flgq$rk8$2 AT sea DOT gmane DOT org> <d5ktvq$194$1 AT sea DOT gmane DOT org> <d5vt1u$9he$1 AT sea DOT gmane DOT org>
In-Reply-To: <d5vt1u$9he$1@sea.gmane.org>
X-IsSubscribed: yes

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Pekka Niiranen on 5/12/2005 9:42 AM:
> Commenting out ANY one of those 7 lines fixed the problem.
> It seems I was running out of some resources
> but cannot explain what is it.
> 
> Is "$((  ))" for arithmetic safer? Anyone?

$(( )) is certainly faster in bash, as it a builtin and avoids forking,
but does not work under ash (/bin/sh).  As long as you are happy with
bash-isms and nonportable code, definitely go for the $(( )) idiom.

For a comparison:
$ strace bash -c 'echo $(( 1 + 1 ))' | grep fork | wc
      0       0       0
$ strace bash -c 'echo `expr 1 + 1`' | grep fork | wc
     41     486    3615

- --
Life is short - so eat dessert first!

Eric Blake             ebb9 AT byu DOT net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFChKGi84KuGfSFAYARAlIVAKC+0rXLLtK52GqfhvlvoXFcUHoZmwCgmWWa
9I/N9CUpnbKLZ+Pve653SHY=
=pIDY
-----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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019