Path: csiph.com!news.mixmin.net!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Spiros Bousbouras Newsgroups: comp.unix.programmer Subject: Re: Piping to stdin Date: Sun, 13 Aug 2023 14:27:35 -0000 (UTC) Organization: A noiseless patient Spider Lines: 27 Message-ID: References: <9e7a4bd1-bfbb-4df7-af1a-27ca9625e50bn@googlegroups.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Injection-Date: Sun, 13 Aug 2023 14:27:35 -0000 (UTC) Injection-Info: dont-email.me; posting-host="3be25fa73c86264f344f4f91b574e804"; logging-data="1967822"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18qUcTjStZDTzDIun4t4fLf" Cancel-Lock: sha1:R+THXx6n+ztQtUw1UH07AE/XA50= X-Organisation: Weyland-Yutani X-Server-Commands: nowebcancel In-Reply-To: Xref: csiph.com comp.unix.programmer:14304 On Sun, 13 Aug 2023 07:07:55 -0700 (PDT) Malcolm McLean wrote: > On Sunday, 13 August 2023 at 14:55:57 UTC+1, Spiros Bousbouras wrote: > > [ Followup-To: comp.unix.programmer ] > > On Sun, 13 Aug 2023 06:42:17 -0700 (PDT) > > Malcolm McLean wrote: > > > On Unix-lke systems, what is the convention for putting a program into a > > > mode where it accepts input from stdin? > > > Where the user invokes it directly, he'll normally want input from a file. So > > > the normal invocation would be > > > > > > myprogram myinput.txt > > > > > > But if he just types "myprogram" it should display brief help text. So we > > > can't omit the filename to make the program read from stdin. [...] > > > So do you pass an option > > > > > > myprogram -stdin > > > > > > or what is the normal way of solving this? > > - (a single dash) as argument. Even if the programme accepts multiple file > > name arguments , a single dash among those means "read from stdin". > > > So conventionally the file name is "-"? Yes.