Path: csiph.com!3.us.feeder.erje.net!feeder.erje.net!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: mike b Newsgroups: gnu.bash.bug Subject: Re: Reading from a file by using its FD returns its contents only once Date: Mon, 31 Dec 2018 18:19:06 +0100 Lines: 46 Approved: bug-bash@gnu.org Message-ID: References: NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Trace: usenet.stanford.edu 1546276767 1549 208.118.235.17 (31 Dec 2018 17:19:27 GMT) X-Complaints-To: action@cs.stanford.edu To: Tadeus Prastowo , bug-bash@gnu.org Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=+6EGGJ3wP4sPAEUYtJ/dhA1vQFvfNK8fT2C/9ibFZio=; b=LmeEUJ/EQZFpVsRZGCoilk/qLmS4H6kEc+LKYNxFw6CLPtkDQHsxLMOWBq15SMaVQS RfH/ulWDtDLSHGuBU9DSrpV7Xc+Jb/k7pdpxgbuKgId7ut51IIqdIm1qYv4+shuUg+9E 4Y7h/URIJPiCBm57pbbU4+VCQjDNwOVYmqGsq0BxpWyGgZJAAqgd/GR8BsgpmQXvVTgq j8O/VcmM4fwSY5pNueDYwza9+KzS4RXpWjkng/Wpdyn6RS41/Rdk7H7+OPWyfYCCxpBb zh+FJU/RYx2+9kUqqq4c1FhZ2QQvTzP1t0TS+1VomN1rNjtBE8if14ps9vD2mIWK/Hhh 7DgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=+6EGGJ3wP4sPAEUYtJ/dhA1vQFvfNK8fT2C/9ibFZio=; b=bzV+/EMzSgGA3bRxv/fwyhPIuujJuWOU7d0ZASBR1cWtDLdSvz2Udbv55osF7GYnyo 07/xoe9Deljsj5n4VdsBEhi1M97yPOg85YClXJexFS0zu4wjtL8DrDTCY9SooEqlttA2 wjzuwRxsrykViF9+blG6HlkbPJSGBqOiXPjlMZP3hyJoV3aMP/+EjSv8/N2gxgoxpjIJ kPKgGLyl64e4Zr/qNAz8knLDgLWaaxIRMcKFVXEjJYzcyt9BhcEVE3SridnrqnUHFHdf aB3/oXwzsQwXHiMoCp28Qwh1juntyK4i/bSBAg8iLowcC+fdyrW2hU5wVezu62UZpJuz Y4kA== X-Gm-Message-State: AA+aEWboNlxThpnA1C8PBc90BHlSFZ6aIWCDGfuOo0JVTfaWoIA1w7fE e3rQJ53EklOw6frBBhOBXvTJaJUOsOB7Wwpa4zCFVw== X-Google-Smtp-Source: AFSGD/WxqM2h/+u4+MVXm+VUvaC0MIIAVo7tI/PG63jNzm0F7SvHFMRU4SQlkiktSktnMZY9gEwF5o/hYx+7EB+ova8= X-Received: by 2002:a62:4c5:: with SMTP id 188mr39153275pfe.130.1546276758910; Mon, 31 Dec 2018 09:19:18 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::429 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:15017 That's a good point, I haven't thought about it like this. I always thought that each read always starts at the beginning of the file given fd points at. So the fact that it changes offset is a bit surprising: # echo word >t # exec {in} napisa=C5=82(a): > On Mon, Dec 31, 2018 at 2:37 AM mike b wrote= : > > [...] > > > The above is just an example. Doing reads on any other regular file lik= e > > this yields same behavior: > > # echo bla >./t > > # exec 10<./t > > # read -r <&10 > > # echo $REPLY > > bla > > # read -r <&10 > > # echo $REPLY > > That's correct behavior because the second `read -r' already hits an > EOF, isn't that? > > -- > Best regards, > Tadeus >