delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-SWARE-Spam-Status: | No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,T_RP_MATCHES_RCVD |
X-Spam-Check-By: | sourceware.org |
From: | Adam Dinwoodie <Adam DOT Dinwoodie AT metaswitch DOT com> |
To: | "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com> |
Subject: | RE: Shell script loop runs out of memory |
Date: | Fri, 1 Jun 2012 10:06:14 +0000 |
Deferred-Delivery: | Fri, 1 Jun 2012 10:06:00 +0000 |
Message-ID: | <CE9C056E12502146A72FD81290379E9A4360C787@ENFIRHMBX1.datcon.co.uk> |
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> |
In-Reply-To: | <CANs8wdChyOK7p9zph=g1_jVsNVvg9n+D+srPGJCNYs75=KNKuA@mail.gmail.com> |
MIME-Version: | 1.0 |
X-IsSubscribed: | yes |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.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 base64 to 8bit by delorie.com id q51A9HLM012207 |
AZ 9901 wrote: > 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 ? By my understanding of the discussion, any sort of forking, ie anything that will require the bash interpreter to make a system() call. In particular, including pipes in the above is somewhat of a red herring, since it's not the pipe that's the problem, but the commands either side of it. Calling any sort of executable (script, binary, whatever) will cause a fork. Anything that requires a subshell (in bash, that's the subshell forks, the ( ... ) command syntax, etc), will similarly require a fork. Shell builtins (eg echo) almost certainly won't require a fork. Note that not everything you might expect to be a builtin is, however: bash doesn't have a "sleep" builtin, for example. You can check whether something's a builtin by calling "type command" from the bash shell.
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |