X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=BCdLypL9wUk/spj5 7zy5zr6UkQuh4hOZ0LYtPvTN0PvGT0bSzWZDCsNQHVAGaArP0i0+glXzzI0QJDsL T5bNFzSSXWa8S7W99MPHzdPsHJvIPOYePMxHbEqrueVhHgqS7nfH+VLf622V2hXN yYrUAuH6z1ZTqcPHJEdXlvzkheo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=E8itEXVd+ziD6nG3gdZMSU KCUNI=; b=QzVGrWruyJcVnWcXMD2t/WPMi2yp2mu9pYTE1Flq7yCW5IrhKCrKkX ke16+VyCFH+2tdv3CIGkJbvDHKtTncYxjfvi4BM7rIXo7lQLErr/VDlyAW2QLNNl a4qy3Qf2N1z+SUDKo5lnq3+eo5LdRWclV1KLQhQ1EvEXx3J3mDHHo= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=0.5 required=5.0 tests=BAYES_40,FREEMAIL_FROM,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=no version=3.3.2 spammy=cyg, Bash, UD:hello.sh, BEGIN X-HELO: mail-it1-f173.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=pzwAGbUmmMVaPwGIlu5k+Ei4sUMkmeXucHCyvbZ+JVg=; b=JaGwqHSsrWvOmDyhL8csYYeDKBV+IeIdb220I0xlr9AcLjZP4tleKWTwNLo1NAJO4P gX3n8cckOUfyrFoyov0dl1Sw02cKELsdxNB2lrp+aayrEtTxsqg+WVo7tWoeaXGpRKRh EeKwpBrNB0L+OLUXy+T2PUCe6/pxhp5507nZ1dNjBKXmTV36MW4dC1JrJ4LW92qfi7Bs h1J8y4q2+Y8haVpSsfstCvG0DcVqVZF9hNIRRZO0xcx+v0084nvWuVeW6Sz3CVj/uiwu hpXvKW57Cris6rsiPIz1mGR2PWvTXPkSpmEuF1N1xCpRqwQJwdutW/ChOT5rMA3pvtQf 8Jvw== Subject: Re: Bash heredoc on FD 3 To: cygwin AT cygwin DOT com References: <5c0427c5 DOT 1c69fb81 DOT d71e5 DOT c8ec AT mx DOT google DOT com> From: cyg Simple Message-ID: Date: Mon, 3 Dec 2018 10:55:57 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Note-from-DJ: This may be spam On 12/3/2018 10:43 AM, cyg Simple wrote: > > On 12/2/2018 1:43 PM, Steven Penny wrote: >> Using this file: >> >>     $ cat hello.sh >>     awk -f /dev/fd/3 3<>     BEGIN { >>       print "hello world" >>     } >>     eof >> >> it runs as expected with Dash: >> >>     $ dash hello.sh >>     hello world >> >> However it fails with Bash: >> >>     $ bash hello.sh >>     awk: fatal: can't open source file `/dev/fd/3' for reading (No >> such file or >>     directory) >> >> I tried also with Debian and both Dash and Bash work as expected. What is >> causing Cygwin Bash to fail here? > > Same for me and interestingly: > > $ ls -ld /dev/fd/* > ls: cannot access '/dev/fd/3': No such file or directory > ls: cannot access '/dev/fd/31': No such file or directory > lrwxrwxrwx 1 eboyd53 eboyd53 0 Dec  3 10:39 /dev/fd/0 -> /dev/pty2 > lrwxrwxrwx 1 eboyd53 eboyd53 0 Dec  3 10:39 /dev/fd/1 -> /dev/pty2 > lrwxrwxrwx 1 eboyd53 eboyd53 0 Dec  3 10:39 /dev/fd/2 -> /dev/pty2 And: $ dash -c '/bin/ls -l /dev/fd/' total 0 lrwxrwxrwx 1 eboyd53 eboyd53 0 Dec 3 10:51 0 -> /dev/pty2 lrwxrwxrwx 1 eboyd53 eboyd53 0 Dec 3 10:51 1 -> /dev/pty2 lrwxrwxrwx 1 eboyd53 eboyd53 0 Dec 3 10:51 2 -> /dev/pty2 lrwxrwxrwx 1 eboyd53 eboyd53 0 Dec 3 10:51 3 -> /proc/27356/fd $ dash -c '/bin/ls -l /dev/fd/' total 0 lrwxrwxrwx 1 eboyd53 eboyd53 0 Dec 3 10:51 0 -> /dev/pty2 lrwxrwxrwx 1 eboyd53 eboyd53 0 Dec 3 10:51 1 -> /dev/pty2 lrwxrwxrwx 1 eboyd53 eboyd53 0 Dec 3 10:51 2 -> /dev/pty2 lrwxrwxrwx 1 eboyd53 eboyd53 0 Dec 3 10:51 3 -> /proc/18740/fd So in Bash the process is no longer available. Adding -d to the above: $ dash -c '/bin/ls -ld /dev/fd/*' /bin/ls: cannot access '/dev/fd/3': No such file or directory lrwxrwxrwx 1 eboyd53 eboyd53 0 Dec 3 10:50 /dev/fd/0 -> /dev/pty2 lrwxrwxrwx 1 eboyd53 eboyd53 0 Dec 3 10:50 /dev/fd/1 -> /dev/pty2 lrwxrwxrwx 1 eboyd53 eboyd53 0 Dec 3 10:50 /dev/fd/2 -> /dev/pty2 -- 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