Path: ...!weretis.net!feeder9.news.weretis.net!news.quux.org!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Lem Novantotto Newsgroups: comp.unix.shell Subject: Re: Using << and an output pipe together in shell (bash) Date: Fri, 1 Nov 2024 15:39:37 -0000 (UTC) Organization: A noiseless patient Spider Lines: 62 Message-ID: References: <87r07v99wd.fsf@bsb.me.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Fri, 01 Nov 2024 16:39:37 +0100 (CET) Injection-Info: dont-email.me; posting-host="a88e548459fc226e0e66a7d936d8e0ba"; logging-data="3354149"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+almLQZN/RYerXMEzmtWTggh/m2RtoWa0=" User-Agent: Pan/0.160 (Toresk; ) Cancel-Lock: sha1:OfwXxdHY+FJZWaQjNR/qacJDG1k= Bytes: 2612 Il Fri, 1 Nov 2024 09:01:15 -0000 (UTC), Kenny McCormack ha scritto: > I think I actually prefer to stick with; > >(cmd ...) Note that cat << EOF | grep . ; echo end and also (cat | grep .) << EOF ; echo end produce the same output: --------------------------------------------------------- lem@biggy:~$ cat << EOF | grep . ; echo end start EOF start end lem@biggy:~$ --------------------------------------------------------- lem@biggy:~$ (cat | grep .) << EOF ; echo end > start > EOF start end lem@biggy:~$ --------------------------------------------------------- Instead with "cat << EOF > >(grep .) ; echo end" the output is unpredictable. You can very well get, as usual: --------------------------------------------------------- lem@biggy:~$ cat << EOF > >(grep .) ; echo end start EOF start end lem@biggy:~$ --------------------------------------------------------- OR maybe: --------------------------------------------------------- lem@biggy:~$ cat << EOF > >(grep .) ; echo end start EOF end start lem@biggy:~$ --------------------------------------------------------- OR even, most of the time: --------------------------------------------------------- lem@biggy:~$ cat << EOF > >(grep .) ; echo end start EOF end lem@biggy:~$ start [you press ENTER here and get back an empty prompt] lem@biggy:~$ --------------------------------------------------------- So sometimes it's better to be careful. :) -- Bye, Lem