delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/06/01/05:52:08

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-3.0 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <CANs8wdChyOK7p9zph=g1_jVsNVvg9n+D+srPGJCNYs75=KNKuA@mail.gmail.com>
References: <loom DOT 20120531T193933-322 AT post DOT gmane DOT org> <CANs8wdBYOBGsmp2iFSSOOd5FZ4qb3i3a-E2EM8LBbPKz=su5Pg AT mail DOT gmail DOT com> <786EBDA1AC46254B813E200779E7AD36023A42C2 AT srv1163ex1 DOT flightsafety DOT com> <loom DOT 20120531T211830-607 AT post DOT gmane DOT org> <0105D5C1E0353146B1B222348B0411A20A770C827D AT NIHMLBX02 DOT nih DOT gov> <CE9C056E12502146A72FD81290379E9A4360C73F AT ENFIRHMBX1 DOT datcon DOT co DOT uk> <CANs8wdChyOK7p9zph=g1_jVsNVvg9n+D+srPGJCNYs75=KNKuA AT mail DOT gmail DOT com>
Date: Fri, 1 Jun 2012 11:51:40 +0200
Message-ID: <CANs8wdCYg0iqpjh0GJ_gpTtQtw9kGi4wTMwyJ=PgsUAoAmJJsg@mail.gmail.com>
Subject: Re: Shell script loop runs out of memory
From: AZ 9901 <az9901 AT gmail DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
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
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id q519px4e011277

2012/6/1 AZ 9901:
> 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
- ( instructions ) : prefer { instructions } construction if possible
- anything else from your point of view ?

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


- Raw text -


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