Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #263792
| From | Max Nikulin <manikulin@gmail.com> |
|---|---|
| Newsgroups | linux.debian.user |
| Subject | Re: bash vs. dash and stdin |
| Date | 2023-11-23 12:10 +0100 |
| Message-ID | <HDfKO-7v51-15@gated-at.bofh.it> (permalink) |
| References | <HCUdk-7des-11@gated-at.bofh.it> <HCUmZ-7dhz-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 22/11/2023 19:17, Greg Wooledge wrote: > On Wed, Nov 22, 2023 at 07:06:58PM +0700, Max Nikulin wrote: >> >> ssh localhost echo remote >> echo local > > This is like <https://mywiki.wooledge.org/BashFAQ/089>. ssh grabs > all of the stdin (until EOF) and leaves none for bash. Thanks. I expected to find it among pitfalls. > I don't know dash's internals. Maybe dash reads an entire buffer's > worth of stdin at a time, instead of a command at a time as bash does. It seems dash reads a block from stdin (and does not lseek back even for regular files) only for commands. I do not see significant difference when commands reading stdin are placed into a script cmd='seq 1000000 | while read -r var ; do printf "%s\n" "$var" ; ssh localhost echo remote ; done' bash -c "$cmd" dash -c "$cmd" >> If the script is passed as an argument, not to stdin, then output contains >> "local" in both cases. > > Yes. In that case, bash is not competing with ssh for stdin. I have found an attempt to report it: https://lore.kernel.org/dash/6640a8ee-eda0-1e35-df1a-c8b303440ca1@mail.de/ stdin should be consumed line by line. Fri, 22 Oct 2021 13:11:43 +0200 No response.
Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
bash vs. dash and stdin Max Nikulin <manikulin@gmail.com> - 2023-11-22 13:10 +0100
Re: bash vs. dash and stdin Greg Wooledge <greg@wooledge.org> - 2023-11-22 13:20 +0100
Re: bash vs. dash and stdin Max Nikulin <manikulin@gmail.com> - 2023-11-23 12:10 +0100
Re: bash vs. dash and stdin Nicolas George <george@nsup.org> - 2023-11-22 13:20 +0100
csiph-web