This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Shell script loop runs out of memory
- From: AZ 9901 <az9901 at gmail dot com>
- To: cygwin at cygwin dot com
- Date: Fri, 1 Jun 2012 11:36:57 +0200
- Subject: Re: Shell script loop runs out of memory
- References: <loom.20120531T193933-322@post.gmane.org> <CANs8wdBYOBGsmp2iFSSOOd5FZ4qb3i3a-E2EM8LBbPKz=su5Pg@mail.gmail.com> <786EBDA1AC46254B813E200779E7AD36023A42C2@srv1163ex1.flightsafety.com> <loom.20120531T211830-607@post.gmane.org> <0105D5C1E0353146B1B222348B0411A20A770C827D@NIHMLBX02.nih.gov> <CE9C056E12502146A72FD81290379E9A4360C73F@ENFIRHMBX1.datcon.co.uk>
2012/6/1 Adam Dinwoodie:
> Buchbinder, Barry wrote:
>> You might try changing
>> Â Â [[ condition ]]
>> to
>> Â Â [ condition ]
>> Perhaps single brackets use memory differently than double brackets.
>
> They do: [[ condition ]] is interpreted by the shell; [ condition ] forks to
> call /usr/bin/[.exe. If forking is the problem, that'll make it worse.
>
So some things to avoid while (bash)scripting under Cygwin to limit
BLODA effect :
- | : pipe stdout --> stdin
- $(...) : subshell fork
- `...` : same as before, subshell fork
- [ condition ] : prefer [[ condition ]] construction
- anything else ?
Ben
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple