This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: SOLUTION: Strange behaviour with output redirection (MORE information, Bug in awk.exe?)


-----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@byu.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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]