From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 36132 invoked by alias); 22 Aug 2016 19:32:16 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 36079 invoked by uid 89); 22 Aug 2016 19:32:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=cygsimplegmailcom, cygsimple@gmail.com, H*f:sk:b12f15c, H*i:sk:b12f15c X-HELO: mail-lf0-f44.google.com Received: from mail-lf0-f44.google.com (HELO mail-lf0-f44.google.com) (209.85.215.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 22 Aug 2016 19:32:05 +0000 Received: by mail-lf0-f44.google.com with SMTP id b199so85534379lfe.0 for ; Mon, 22 Aug 2016 12:32:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-transfer-encoding; bh=USb/3yrG4MP89YDgtLsf2E0eoj3FFAx6ak50J7F0v0U=; b=eSJIAFmhunfL3Q5c+XO+bersX8XSSZ7qHyxCj4Fl6ZhS1lyMORHqJPvwBiJreDZ0Oc EOAyO3jMAvkiIR+w/ozfelaZ0p3aX/2Ha2Dv2PsB4MRHX6xaBBOpfB7VmrzHemRpXNEl MwLcX9R/5OqctfqcbAKBtd+GPOoztk/es1o3gOsJiC528nh4BuWjkID1+ybW9/nb4mP2 iCCe7qeJpYJHWYH3xg0FM0NjyrzljLGWiU0F/c1CCy92m4tCUinSStbySGhs1bmnw+b/ Axd+afL9YLWGEjDoc1C4EKrwtWF73Hlx3rIV6QRrE86SKDBNH6TzHiuVaHaT9nVpAo1j WMqA== X-Gm-Message-State: AEkooutCJqI12jsF2nygp9JqiAh0z9kqEv5x32G71UmLMaVvQQm2zGMYcQeo1UJz0vjORrN/D8zcf2Tkh18QOw== X-Received: by 10.25.163.132 with SMTP id m126mr6622454lfe.56.1471894323093; Mon, 22 Aug 2016 12:32:03 -0700 (PDT) MIME-Version: 1.0 Received: by 10.25.213.204 with HTTP; Mon, 22 Aug 2016 12:31:42 -0700 (PDT) In-Reply-To: References: From: =?UTF-8?Q?Morten_Kj=C3=A6rulff?= Date: Mon, 22 Aug 2016 23:13:00 -0000 Message-ID: Subject: Re: #!/bin/sh and #!/bin/bash is not the same To: cygwin@cygwin.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2016-08/txt/msg00407.txt.bz2 On Mon, Aug 22, 2016 at 8:51 PM, cyg Simple wrote: > Please do not TOP POST. > > On 8/22/2016 10:36 AM, Morten Kj=C3=A6rulff wrote: >> Thanks. >> >> What I was actually trying, was this: >> >> echo a | while read ; do >> some_command & >> done >> wait >> >> The "wait" did not wait. I guessed the reason was that "some_command >> &" was executed in a subshell. >> >> So I tried: >> >> while read ; do >> some_command & >> done < <(echo a) >> wait >> >> It was working, however not with #!/bin/sh >> > > What does ``/bin/sh --version'' print? > > The wait command is a shell internal command, there is no external > equivalent. If you /bin/sh is bash then perhaps you've found a bug in > the emulation of /bin/sh in bash. Bash takes a different code path when > named sh. > > -- > cyg Simple > > -- > 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 > Sorry, I think I have been confusing. This: date echo a | while read ; do sleep 3 & done wait date will run in 0 seconds, with BOTH /bin/sh and /bin/bash This: date while read ; do sleep 3 & done < <(echo a) wait date will run in 3 seconds with /bin/bash and get syntax errors with /bin/sh: syntax error near unexpected token `<' `done < <(echo a)' $ /bin/sh --version GNU bash, version 4.3.46(6)-release (x86_64-unknown-cygwin) Copyright (C) 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software; you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. I believe all is ok. /Morten -- 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