Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Type louder, please.


devel / comp.unix.programmer / Re: Piping to stdin

SubjectAuthor
* Piping to stdinSpiros Bousbouras
+* Piping to stdinSpiros Bousbouras
|`* Piping to stdinKenny McCormack
| +* Piping to stdinKaz Kylheku
| |`* Piping to stdinKenny McCormack
| | `* Piping to stdinKalevi Kolttonen
| |  `* Piping to stdinGary R. Schmidt
| |   +* Piping to stdinKaz Kylheku
| |   |+* Piping to stdinJoe Pfeiffer
| |   ||`* Piping to stdinRichard Harnden
| |   || `- Piping to stdinPhil Carmody
| |   |+- Piping to stdinKeith Thompson
| |   |`* Piping to stdinRichard Kettlewell
| |   | +* Piping to stdinJames Kuyper
| |   | |`- Piping to stdinDavid Brown
| |   | +- Dealing with weird filenames (Was: Piping to stdin)Kenny McCormack
| |   | `* Piping to stdinDavid Brown
| |   |  +* Piping to stdinRichard Kettlewell
| |   |  |`* Piping to stdinScott Lurndal
| |   |  | +- Piping to stdinKenny McCormack
| |   |  | +* Piping to stdinSpiros Bousbouras
| |   |  | |`* Piping to stdinKaz Kylheku
| |   |  | | `- Piping to stdinKaz Kylheku
| |   |  | +* Piping to stdinKeith Thompson
| |   |  | |`* Piping to stdinGeoff Clare
| |   |  | | `- Piping to stdinKeith Thompson
| |   |  | `- Piping to stdinPhil Carmody
| |   |  `* Piping to stdinRichard Harnden
| |   |   +- Piping to stdinScott Lurndal
| |   |   `- Piping to stdinvallor
| |   `* Piping to stdinKalevi Kolttonen
| |    +* Piping to stdinGiovanni
| |    |`* Piping to stdinKenny McCormack
| |    | `* Piping to stdinKalevi Kolttonen
| |    |  +* Piping to stdinPhil Carmody
| |    |  |`* Piping to stdinLew Pitcher
| |    |  | `* Piping to stdinPhil Carmody
| |    |  |  `* Piping to stdinLew Pitcher
| |    |  |   +- Piping to stdinKaz Kylheku
| |    |  |   `- Piping to stdinPhil Carmody
| |    |  +- Piping to stdinBen Bacarisse
| |    |  `* Piping to stdinMuttley
| |    |   +* Piping to stdinPhil Carmody
| |    |   |`* Piping to stdinMuttley
| |    |   | +* Piping to stdinPhil Carmody
| |    |   | |+* Piping to stdinGeoff Clare
| |    |   | ||`- Piping to stdinMuttley
| |    |   | |+* Wrecking a good thing? (Was: Piping to stdin)Kenny McCormack
| |    |   | ||+- Wrecking a good thing?Phil Carmody
| |    |   | ||`- Wrecking a good thing? (Was: Piping to stdin)David Brown
| |    |   | |`- Piping to stdinMuttley
| |    |   | +* Piping to stdinKaz Kylheku
| |    |   | |+- Piping to stdinMuttley
| |    |   | |+- Piping to stdinKeith Thompson
| |    |   | |`- Piping to stdinDavid Brown
| |    |   | `* Piping to stdinBen Bacarisse
| |    |   |  `* Piping to stdinPhil Carmody
| |    |   |   +* Piping to stdinOğuz
| |    |   |   |`* Piping to stdinMuttley
| |    |   |   | +* Piping to stdinScott Lurndal
| |    |   |   | |`- Piping to stdinMuttley
| |    |   |   | `* Piping to stdinRainer Weikusat
| |    |   |   |  `* What language is this? (Was: Piping to stdin)Kenny McCormack
| |    |   |   |   `* What language is this? (Was: Piping to stdin)Scott Lurndal
| |    |   |   |    +* What language is this? (Was: Piping to stdin)Kenny McCormack
| |    |   |   |    |`* What language is this?Rainer Weikusat
| |    |   |   |    | `* What language is this?Kenny McCormack
| |    |   |   |    |  `* What language is this?Rainer Weikusat
| |    |   |   |    |   `* What language is this?Kenny McCormack
| |    |   |   |    |    `- What language is this?Rainer Weikusat
| |    |   |   |    `- What language is this? (Was: Piping to stdin)Muttley
| |    |   |   `* Piping to stdinBen Bacarisse
| |    |   |    `- Piping to stdinKalevi Kolttonen
| |    |   +* Piping to stdinKalevi Kolttonen
| |    |   |`* Piping to stdinMuttley
| |    |   | `* Piping to stdinKalevi Kolttonen
| |    |   |  `- Piping to stdinScott Lurndal
| |    |   `- Piping to stdinKaz Kylheku
| |    `- Piping to stdinPhil Carmody
| `- Piping to stdinNuno Silva
`* Piping to stdinJoe Pfeiffer
 `* Piping to stdinSpiros Bousbouras
  `* Piping to stdinBen Bacarisse
   `* Piping to stdinKenny McCormack
    `* Piping to stdinScott Lurndal
     `* Piping to stdinRichard Harnden
      `- Piping to stdinScott Lurndal

Pages:1234
Re: Piping to stdin

<ubg8no$2t2as$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9875&group=comp.unix.programmer#9875

  copy link   Newsgroups: comp.unix.programmer comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: kal...@kolttonen.fi (Kalevi Kolttonen)
Newsgroups: comp.unix.programmer,comp.lang.c
Subject: Re: Piping to stdin
Date: Tue, 15 Aug 2023 16:22:16 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 27
Sender: <untosten@0.0.0.0>
Message-ID: <ubg8no$2t2as$1@dont-email.me>
References: <9e7a4bd1-bfbb-4df7-af1a-27ca9625e50bn@googlegroups.com> <vo5rqj-lpl.ln1@paranoia.mcleod-schmidt.id.au> <ubg25m$2rr3g$1@dont-email.me> <ubg4no$8kb$1@milena.home.net.it> <ubg6o7$3jrsn$1@news.xmission.com> <ubg853$2ssj8$1@dont-email.me> <ubg8a8$2t20l$1@dont-email.me>
Injection-Date: Tue, 15 Aug 2023 16:22:16 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="7ec138b6644db226e9ac07c06a0689d0";
logging-data="3049820"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX195bIexprEVjkHU/NP9K59BRFbICwcSmdc="
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (Linux/6.4.9-200.fc38.x86_64 (x86_64))
Cancel-Lock: sha1:GgAbFVzy196mycShbmM8D3rKmsU=
 by: Kalevi Kolttonen - Tue, 15 Aug 2023 16:22 UTC

In comp.unix.programmer Muttley@dastardlyhq.com wrote:
> On Tue, 15 Aug 2023 16:12:19 -0000 (UTC)
> kalevi@kolttonen.fi (Kalevi Kolttonen) wrote:
>>Kenny McCormack <gazelle@shell.xmission.com> wrote:
>>> But do they know that???
>>
>>"They" probably don't know it. But let's face it,
>>nobody really wants to create a file having '-'
>>filename on purpose. The filename is not descriptive
>>at all, it would be just an insane choice for anything
>>useful.
>
> I used to think the same thing about spaces in filenames. Then along came
> Windows.

Filenames having spaces versus the stdin convention '-' is
comparing two things that are very different.

The first one is just a way to name files or directories.

The second one is an age-old Unix convention that has
nothing to do with naming real files or directories.

It is best to not to confuse these two distinct ideas.

br,
KK

Re: Piping to stdin

<20230815102503.811@kylheku.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9876&group=comp.unix.programmer#9876

  copy link   Newsgroups: comp.unix.programmer comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.unix.programmer,comp.lang.c
Subject: Re: Piping to stdin
Date: Tue, 15 Aug 2023 17:33:42 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 50
Message-ID: <20230815102503.811@kylheku.com>
References: <9e7a4bd1-bfbb-4df7-af1a-27ca9625e50bn@googlegroups.com>
<vo5rqj-lpl.ln1@paranoia.mcleod-schmidt.id.au>
<ubg25m$2rr3g$1@dont-email.me> <ubg4no$8kb$1@milena.home.net.it>
<ubg6o7$3jrsn$1@news.xmission.com> <ubg853$2ssj8$1@dont-email.me>
<ubg8a8$2t20l$1@dont-email.me>
Injection-Date: Tue, 15 Aug 2023 17:33:42 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="12961595d97071749275a1c93b8d4ac5";
logging-data="3069671"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19gFnUUof9/OvbDQUhNGiUuByjAjnvo2Sc="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:FjzVDmYcI1cUaTpMQbcQyckfIF4=
 by: Kaz Kylheku - Tue, 15 Aug 2023 17:33 UTC

On 2023-08-15, Muttley@dastardlyhq.com <Muttley@dastardlyhq.com> wrote:
> On Tue, 15 Aug 2023 16:12:19 -0000 (UTC)
> kalevi@kolttonen.fi (Kalevi Kolttonen) wrote:
>>Kenny McCormack <gazelle@shell.xmission.com> wrote:
>>> But do they know that???
>>
>>"They" probably don't know it. But let's face it,
>>nobody really wants to create a file having '-'
>>filename on purpose. The filename is not descriptive
>>at all, it would be just an insane choice for anything
>>useful.
>
> I used to think the same thing about spaces in filenames. Then along came
> Windows.

Windows users typically do not name files "-" either,
in spite of there being spaces in file and directory names.

A program that handles - specially will not be confused when
that occurs in a path like /abc/-/def or ./- or -/ and other
possibilities.

Windows has worse problems, like issues if you try to make
a file called PRN in any directory.

"* Do not use the following reserved names for the name of a file:

CON, PRN, AUX, NUL, COM0, COM1, COM2, COM3, COM4, COM5, COM6, COM7,
COM8, COM9, LPT0, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8,
and LPT9. Also avoid these names followed immediately by an
extension; for example, NUL.txt and NUL.tar.gz are both equivalent
to NUL. For more information, see Namespaces."

In Microsoft Teams, channel names cannot have MS-DOS device names:

https://learn.microsoft.com/en-us/microsoftteams/limits-specifications-teams

"Channel names can't contain the following characters or words:

[...]

Words forms, CON, CONIN$, CONOUT$, PRN, AUX, NUL, COM1 to COM9, LPT1
to LPT9, desktop.ini, _vti_

LOL ...

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Re: Piping to stdin

<1by1ic2n67.fsf@pfeifferfamily.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9877&group=comp.unix.programmer#9877

  copy link   Newsgroups: comp.unix.programmer comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: pfeif...@cs.nmsu.edu (Joe Pfeiffer)
Newsgroups: comp.unix.programmer,comp.lang.c
Subject: Re: Piping to stdin
Date: Tue, 15 Aug 2023 12:08:48 -0600
Organization: A noiseless patient Spider
Lines: 40
Message-ID: <1by1ic2n67.fsf@pfeifferfamily.net>
References: <9e7a4bd1-bfbb-4df7-af1a-27ca9625e50bn@googlegroups.com>
<LtQSo3SOOU09AXJ1X@bongo-ra.co> <ubbua5$3hium$1@news.xmission.com>
<20230813200644.979@kylheku.com> <ubc63c$3hlul$2@news.xmission.com>
<ubdgcv$2carp$2@dont-email.me>
<vo5rqj-lpl.ln1@paranoia.mcleod-schmidt.id.au>
<20230814215312.550@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="16cda29c1a3f534d1a4872782d89356b";
logging-data="3081156"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19PY2g0uI8DjR7ozC3eG0lTOzZAIisJVV0="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:AVAYCYwkwFTtO23UCPAIbEvj9kI=
sha1:FidN2wjiv6kZBa0pkbEq+kMua30=
 by: Joe Pfeiffer - Tue, 15 Aug 2023 18:08 UTC

Kaz Kylheku <864-117-4973@kylheku.com> writes:

> On 2023-08-15, Gary R. Schmidt <grschmidt@acm.org> wrote:
>> On 15/08/2023 01:14, Kalevi Kolttonen wrote:
>>> In comp.unix.programmer Kenny McCormack <gazelle@shell.xmission.com> wrote:
>>>> You know that - and I know that - but do they know that?
>>>
>>> It makes no difference. In the real world nobody has
>>> files named '-'.
>>>
>>> br,
>>> KK
>>
>> Ahah! You don't have users, do you?
>>
>> No doubt you also don't encounter filenames with spaces in them, or
>> carriage returns, or other garbage.
>
> The interesction of:
>
> - Users who make filenames like "-foo" and "monthly forecast.xls"
>
> - Users who sit in a POSIX shell expanding wildcards like *
> in the same directory.
>
> is probababy vanishingly nil, and the subset of those who do the
> above in the same directory is even smaller.
>
> Now admin scripts do have to handle the files created by the goofy users
> in the first category.
>
> Admin scripts don't ahve to worry about users creating a file
> called -, because admin scripts won't be run in the directory
> where the user did that. Not even scripts which do process
> paths traversing that directory. The admin (or cron, or systemd or
> whatever) will run those from somewhere else.

Though I expect just about everyone has tried to run foo -xyz and
inadvertently run foo - xyz instead, ending up with a file named - and
one named xyz.

Re: Piping to stdin

<ubghe4$2ubhu$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9878&group=comp.unix.programmer#9878

  copy link   Newsgroups: comp.unix.programmer comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: richard....@gmail.com (Richard Harnden)
Newsgroups: comp.unix.programmer,comp.lang.c
Subject: Re: Piping to stdin
Date: Tue, 15 Aug 2023 19:50:44 +0100
Organization: A noiseless patient Spider
Lines: 45
Message-ID: <ubghe4$2ubhu$1@dont-email.me>
References: <9e7a4bd1-bfbb-4df7-af1a-27ca9625e50bn@googlegroups.com>
<LtQSo3SOOU09AXJ1X@bongo-ra.co> <ubbua5$3hium$1@news.xmission.com>
<20230813200644.979@kylheku.com> <ubc63c$3hlul$2@news.xmission.com>
<ubdgcv$2carp$2@dont-email.me> <vo5rqj-lpl.ln1@paranoia.mcleod-schmidt.id.au>
<20230814215312.550@kylheku.com> <wwvleeceobt.fsf@LkoBDZeT.terraraq.uk>
<ubfus8$2rc7s$1@dont-email.me>
Reply-To: nospam.harnden@gmail.com
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 15 Aug 2023 18:50:44 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="a15a07fd2a1762fba1bf49304712c7a9";
logging-data="3092030"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+pnukHrBoLbqPqzHdp6hhUdp+nSKSFN6c="
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.14.0
Cancel-Lock: sha1:DjrWRzZC46oECXl50/tBkSArq+M=
In-Reply-To: <ubfus8$2rc7s$1@dont-email.me>
 by: Richard Harnden - Tue, 15 Aug 2023 18:50 UTC

On 15/08/2023 14:34, David Brown wrote:
> On 15/08/2023 09:50, Richard Kettlewell wrote:
>> Kaz Kylheku <864-117-4973@kylheku.com> writes:
>>> On 2023-08-15, Gary R. Schmidt <grschmidt@acm.org> wrote:
>>>> Ahah!  You don't have users, do you?
>>>>
>>>> No doubt you also don't encounter filenames with spaces in them, or
>>>> carriage returns, or other garbage.
>>>
>>> The interesction of:
>>>
>>> - Users who make filenames like "-foo" and "monthly forecast.xls"
>>>
>>> - Users who sit in a POSIX shell expanding wildcards like *
>>>    in the same directory.
>>>
>>> is probababy vanishingly nil, and the subset of those who do the
>>> above in the same directory is even smaller.
>>
>> The cases I’ve encountered are where someone accidentally creates a file
>> with a weird name (starts with - or whatever) and then has trouble
>> deleting it. I don’t think they got as far as having accidents with
>> wildcards in the cases I remember, but the basic setup of a file with a
>> ridiculous name and a non-expert user does happen occasionally.
>>
>
> It's usually sufficient just to put the awkward name inside quotation
> marks.
>
>

But people won't/don't do that.

Also:

$ >-f
$ >-r
$ rm *

How to safely cater for all 'weird' inputs?

Re: Piping to stdin

<o2RCM.110346$PlBb.53343@fx42.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9879&group=comp.unix.programmer#9879

  copy link   Newsgroups: comp.unix.programmer comp.lang.c
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx42.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: Piping to stdin
Newsgroups: comp.unix.programmer,comp.lang.c
References: <9e7a4bd1-bfbb-4df7-af1a-27ca9625e50bn@googlegroups.com> <LtQSo3SOOU09AXJ1X@bongo-ra.co> <ubbua5$3hium$1@news.xmission.com> <20230813200644.979@kylheku.com> <ubc63c$3hlul$2@news.xmission.com> <ubdgcv$2carp$2@dont-email.me> <vo5rqj-lpl.ln1@paranoia.mcleod-schmidt.id.au> <20230814215312.550@kylheku.com> <wwvleeceobt.fsf@LkoBDZeT.terraraq.uk> <ubfus8$2rc7s$1@dont-email.me> <ubghe4$2ubhu$1@dont-email.me>
Lines: 44
Message-ID: <o2RCM.110346$PlBb.53343@fx42.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Tue, 15 Aug 2023 20:16:20 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Tue, 15 Aug 2023 20:16:20 GMT
X-Received-Bytes: 2435
 by: Scott Lurndal - Tue, 15 Aug 2023 20:16 UTC

Richard Harnden <richard.nospam@gmail.com> writes:
>On 15/08/2023 14:34, David Brown wrote:
>> On 15/08/2023 09:50, Richard Kettlewell wrote:
>>> Kaz Kylheku <864-117-4973@kylheku.com> writes:
>>>> On 2023-08-15, Gary R. Schmidt <grschmidt@acm.org> wrote:
>>>>> Ahah!  You don't have users, do you?
>>>>>
>>>>> No doubt you also don't encounter filenames with spaces in them, or
>>>>> carriage returns, or other garbage.
>>>>
>>>> The interesction of:
>>>>
>>>> - Users who make filenames like "-foo" and "monthly forecast.xls"
>>>>
>>>> - Users who sit in a POSIX shell expanding wildcards like *
>>>>    in the same directory.
>>>>
>>>> is probababy vanishingly nil, and the subset of those who do the
>>>> above in the same directory is even smaller.
>>>
>>> The cases I’ve encountered are where someone accidentally creates a file
>>> with a weird name (starts with - or whatever) and then has trouble
>>> deleting it. I don’t think they got as far as having accidents with
>>> wildcards in the cases I remember, but the basic setup of a file with a
>>> ridiculous name and a non-expert user does happen occasionally.
>>>
>>
>> It's usually sufficient just to put the awkward name inside quotation
>> marks.
>>
>>
>
>But people won't/don't do that.
>
>Also:
>
>$ >-f
>$ >-r
>$ rm *
>
>How to safely cater for all 'weird' inputs?

Well, like any tool, it can be misused. I don't blame
the tool for that, when the tool is still useful.

Re: Piping to stdin

<87sf8k2gw3.fsf@fatphil.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9880&group=comp.unix.programmer#9880

  copy link   Newsgroups: comp.unix.programmer comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: pc+use...@asdf.org (Phil Carmody)
Newsgroups: comp.unix.programmer,comp.lang.c
Subject: Re: Piping to stdin
Date: Tue, 15 Aug 2023 23:24:28 +0300
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <87sf8k2gw3.fsf@fatphil.org>
References: <9e7a4bd1-bfbb-4df7-af1a-27ca9625e50bn@googlegroups.com>
<vo5rqj-lpl.ln1@paranoia.mcleod-schmidt.id.au>
<ubg25m$2rr3g$1@dont-email.me> <ubg4no$8kb$1@milena.home.net.it>
<ubg6o7$3jrsn$1@news.xmission.com> <ubg853$2ssj8$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="9176dbab4427e178b28c3a609a56f3cb";
logging-data="3113645"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18cN8yV+28Rb54Ysg/XpPrl"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Cancel-Lock: sha1:XALYm39ifrrj+s5QaQDiquDMZC4=
sha1:jS1HVQuVZnC/SF8CGYNn4FViNwo=
 by: Phil Carmody - Tue, 15 Aug 2023 20:24 UTC

kalevi@kolttonen.fi (Kalevi Kolttonen) writes:
> Kenny McCormack <gazelle@shell.xmission.com> wrote:
>> But do they know that???
>
> "They" probably don't know it. But let's face it,
> nobody really wants to create a file having '-'
> filename on purpose. The filename is not descriptive
> at all, it would be just an insane choice for anything
> useful.
>
> It could happen by accident, but even that is quite
> unlikely.
>
> If "they" don't know how to delete it, there is no need
> to panic. The file's existence does no harm. "They" can
> always ask for help and someone will tell them how
> to get rid of it.
>
> I guess the stdin convention '-' is decades old.
> It was chosen because they had pick something that
> is short and not likely to exist as a real file.

I propose that '|' might have been better - it's even mnemonic.

Phil
--
We are no longer hunters and nomads. No longer awed and frightened, as we have
gained some understanding of the world in which we live. As such, we can cast
aside childish remnants from the dawn of our civilization.
-- NotSanguine on SoylentNews, after Eugen Weber in /The Western Tradition/

Re: Piping to stdin

<87o7j82gix.fsf@fatphil.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9881&group=comp.unix.programmer#9881

  copy link   Newsgroups: comp.unix.programmer comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: pc+use...@asdf.org (Phil Carmody)
Newsgroups: comp.unix.programmer,comp.lang.c
Subject: Re: Piping to stdin
Date: Tue, 15 Aug 2023 23:32:22 +0300
Organization: A noiseless patient Spider
Lines: 37
Message-ID: <87o7j82gix.fsf@fatphil.org>
References: <9e7a4bd1-bfbb-4df7-af1a-27ca9625e50bn@googlegroups.com>
<vo5rqj-lpl.ln1@paranoia.mcleod-schmidt.id.au>
<ubg25m$2rr3g$1@dont-email.me> <ubg4no$8kb$1@milena.home.net.it>
<ubg6o7$3jrsn$1@news.xmission.com> <ubg853$2ssj8$1@dont-email.me>
<ubg8a8$2t20l$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="9176dbab4427e178b28c3a609a56f3cb";
logging-data="3127462"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ZdG0yVe9y+mdzYYgdvBTQ"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Cancel-Lock: sha1:6R4WBsPcCGkxmq8qQ0xFHAsf3rs=
sha1:TV3sPED6yO6q0TXnu2FZbMYdjX4=
 by: Phil Carmody - Tue, 15 Aug 2023 20:32 UTC

Muttley@dastardlyhq.com writes:
> On Tue, 15 Aug 2023 16:12:19 -0000 (UTC)
> kalevi@kolttonen.fi (Kalevi Kolttonen) wrote:
>>Kenny McCormack <gazelle@shell.xmission.com> wrote:
>>> But do they know that???
>>
>>"They" probably don't know it. But let's face it,
>>nobody really wants to create a file having '-'
>>filename on purpose. The filename is not descriptive
>>at all, it would be just an insane choice for anything
>>useful.
>
> I used to think the same thing about spaces in filenames. Then along came
> Windows.

Your memory if flawed. Spaces were always allowed in unix
filenames. Often used to hide things in plain sight on FTP sites, for
example.

MS Windows didn't allow spaces until Windows 95. I remember the Apple
advert at the time - it was a double-page spread which basically just
said:

C:\NGRTLTNS.W95

in a gajillion-point high font. I pulled that out of a newspaper and
had it on my wall at work. Not because I was an Apple fanboi, far
from it, but my disdain for all things MS Windows was already
entrenched, and I was being forced to use it for the not-the-actual-work
part of my job (which was on Sun workstations).

Phil
--
We are no longer hunters and nomads. No longer awed and frightened, as we have
gained some understanding of the world in which we live. As such, we can cast
aside childish remnants from the dawn of our civilization.
-- NotSanguine on SoylentNews, after Eugen Weber in /The Western Tradition/

Re: Piping to stdin

<ubgoee$2rs7p$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9882&group=comp.unix.programmer#9882

  copy link   Newsgroups: comp.unix.programmer comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: lew.pitc...@digitalfreehold.ca (Lew Pitcher)
Newsgroups: comp.unix.programmer,comp.lang.c
Subject: Re: Piping to stdin
Date: Tue, 15 Aug 2023 20:50:22 -0000 (UTC)
Organization: The Pitcher Digital Freehold
Lines: 52
Message-ID: <ubgoee$2rs7p$1@dont-email.me>
References: <9e7a4bd1-bfbb-4df7-af1a-27ca9625e50bn@googlegroups.com>
<vo5rqj-lpl.ln1@paranoia.mcleod-schmidt.id.au>
<ubg25m$2rr3g$1@dont-email.me> <ubg4no$8kb$1@milena.home.net.it>
<ubg6o7$3jrsn$1@news.xmission.com> <ubg853$2ssj8$1@dont-email.me>
<87sf8k2gw3.fsf@fatphil.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 15 Aug 2023 20:50:22 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="b9fe62aaa481b198f39e9a3eccd39311";
logging-data="3010809"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19na7UcZTXu/ubl2Y6oO4wqrWBJVk/yiWA="
User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508
git://git.gnome.org/pan2)
Cancel-Lock: sha1:LXokw1Vg91DsV/oE21Nlm7aHbV4=
 by: Lew Pitcher - Tue, 15 Aug 2023 20:50 UTC

On Tue, 15 Aug 2023 23:24:28 +0300, Phil Carmody wrote:

> kalevi@kolttonen.fi (Kalevi Kolttonen) writes:
>> Kenny McCormack <gazelle@shell.xmission.com> wrote:
>>> But do they know that???
>>
>> "They" probably don't know it. But let's face it,
>> nobody really wants to create a file having '-'
>> filename on purpose. The filename is not descriptive
>> at all, it would be just an insane choice for anything
>> useful.
>>
>> It could happen by accident, but even that is quite
>> unlikely.
>>
>> If "they" don't know how to delete it, there is no need
>> to panic. The file's existence does no harm. "They" can
>> always ask for help and someone will tell them how
>> to get rid of it.
>>
>> I guess the stdin convention '-' is decades old.
>> It was chosen because they had pick something that
>> is short and not likely to exist as a real file.
>
> I propose that '|' might have been better - it's even mnemonic.

But, '|' conflicts with the shell pipe character, and would need
a workaround in some cases. For example,

foo bar | blech

could either pipe stdout from foo (which processed bar) into
blech, or it could instruct foo to accept bar, stdin and blech
as inputs. And, unless you escape or singlequote the pipe character,
the pipe-command interpretation wins.

Similarly,

foo bar - blech

could either ask foo to read files "bar", "-" and "blech"
/or/ ask foo to read files "bar", stdin, and "blech",
depending on the presence (or absence) of a file named "-"
Again, the accepted method of discerning one from the other
is to modify that "-" to "./-", indicating a file (in the
current working directory) named "-".

So, pOHtato, pAHtato.

--
Lew Pitcher
"In Skills We Trust"

Re: Piping to stdin

<87msyrhgnq.fsf@bsb.me.uk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9883&group=comp.unix.programmer#9883

  copy link   Newsgroups: comp.unix.programmer comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ben.use...@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.unix.programmer,comp.lang.c
Subject: Re: Piping to stdin
Date: Wed, 16 Aug 2023 03:20:25 +0100
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <87msyrhgnq.fsf@bsb.me.uk>
References: <9e7a4bd1-bfbb-4df7-af1a-27ca9625e50bn@googlegroups.com>
<vo5rqj-lpl.ln1@paranoia.mcleod-schmidt.id.au>
<ubg25m$2rr3g$1@dont-email.me> <ubg4no$8kb$1@milena.home.net.it>
<ubg6o7$3jrsn$1@news.xmission.com> <ubg853$2ssj8$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="f23095e1eb81acb3fb188baae9243a4f";
logging-data="3328695"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Ts/QYhZx43iA5K6e+EubPYBGf2OMHxC4="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:bD86P5VUi5kMm6VhrDb72TJDwvc=
sha1:yBhoZnwNsO+Q4Vn0+bIzE2xXD3c=
X-BSB-Auth: 1.ed56b3b3c6ea13cbbc5f.20230816032025BST.87msyrhgnq.fsf@bsb.me.uk
 by: Ben Bacarisse - Wed, 16 Aug 2023 02:20 UTC

kalevi@kolttonen.fi (Kalevi Kolttonen) writes:

> I guess the stdin convention '-' is decades old.
> It was chosen because they had pick something that
> is short and not likely to exist as a real file.

If I were doing this all from scratch, I'd consider choosing /- as the
convention. It's never a "user" file, and anyone capable of creating it
should know how to remove it.

--
Ben.

Re: Piping to stdin

<ubhnad$36om0$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9884&group=comp.unix.programmer#9884

  copy link   Newsgroups: comp.unix.programmer comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: jameskuy...@alumni.caltech.edu (James Kuyper)
Newsgroups: comp.unix.programmer,comp.lang.c
Subject: Re: Piping to stdin
Date: Wed, 16 Aug 2023 01:37:17 -0400
Organization: A noiseless patient Spider
Lines: 32
Message-ID: <ubhnad$36om0$1@dont-email.me>
References: <9e7a4bd1-bfbb-4df7-af1a-27ca9625e50bn@googlegroups.com>
<LtQSo3SOOU09AXJ1X@bongo-ra.co> <ubbua5$3hium$1@news.xmission.com>
<20230813200644.979@kylheku.com> <ubc63c$3hlul$2@news.xmission.com>
<ubdgcv$2carp$2@dont-email.me> <vo5rqj-lpl.ln1@paranoia.mcleod-schmidt.id.au>
<20230814215312.550@kylheku.com> <wwvleeceobt.fsf@LkoBDZeT.terraraq.uk>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 16 Aug 2023 05:37:17 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="564de306bc790f1858bdb09f489e6181";
logging-data="3367616"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+soEDdss4WEnnpebCkNHy3CbpUE4c/wpc="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Cancel-Lock: sha1:ANFITiwTgYdim+DZT4cSclGPNGw=
Content-Language: en-US
In-Reply-To: <wwvleeceobt.fsf@LkoBDZeT.terraraq.uk>
 by: James Kuyper - Wed, 16 Aug 2023 05:37 UTC

On 8/15/23 03:50, Richard Kettlewell wrote:
> Kaz Kylheku <864-117-4973@kylheku.com> writes:
....
>> The interesction of:
>>
>> - Users who make filenames like "-foo" and "monthly forecast.xls"
>>
>> - Users who sit in a POSIX shell expanding wildcards like *
>> in the same directory.
>>
>> is probababy vanishingly nil, and the subset of those who do the
>> above in the same directory is even smaller.
>
> The cases I’ve encountered are where someone accidentally creates a file
> with a weird name (starts with - or whatever) and then has trouble
> deleting it. I don’t think they got as far as having accidents with
> wildcards in the cases I remember, but the basic setup of a file with a
> ridiculous name and a non-expert user does happen occasionally.

The most bizarre filenames I've seen were generally created by one of
two mechanisms: Copy-and-pasting a command line into a terminal window,
where a minor slip of the mouse resulted in the copy including far more
material than it was supposed to. Most of the resulting lines of text do
nothing, but every once in a while a line starts with a word that is a
valid unix command name, and some very weird things happen.

The second scenario is where someone stupidly gave an ordinary text file
execute permission, and someone else accidentally typed the name of that
file in a context where it would invoke the supposed "executable". The
results were similar to those from the copy-and-past problem, except
that some of the text files were much longer, increasing the chance of a
line from the file actually resulting in non-trivial behavior.

Re: Piping to stdin

<ubhqlo$374bv$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9885&group=comp.unix.programmer#9885

  copy link   Newsgroups: comp.unix.programmer comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: val...@cultnix.org (vallor)
Newsgroups: comp.unix.programmer,comp.lang.c
Subject: Re: Piping to stdin
Date: Wed, 16 Aug 2023 06:34:32 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 51
Message-ID: <ubhqlo$374bv$1@dont-email.me>
References: <9e7a4bd1-bfbb-4df7-af1a-27ca9625e50bn@googlegroups.com>
<LtQSo3SOOU09AXJ1X@bongo-ra.co> <ubbua5$3hium$1@news.xmission.com>
<20230813200644.979@kylheku.com> <ubc63c$3hlul$2@news.xmission.com>
<ubdgcv$2carp$2@dont-email.me>
<vo5rqj-lpl.ln1@paranoia.mcleod-schmidt.id.au>
<20230814215312.550@kylheku.com> <wwvleeceobt.fsf@LkoBDZeT.terraraq.uk>
<ubfus8$2rc7s$1@dont-email.me> <ubghe4$2ubhu$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 16 Aug 2023 06:34:32 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="2b5b233b25b27017da6cb2fb007dbeff";
logging-data="3379583"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Qgu6+w9cxDg1DCsP0hOjr"
User-Agent: Pan/0.154 (Izium; b9ffd3c gitlab.gnome.org/GNOME/pan.git)
Cancel-Lock: sha1:Vc5Hv8q9m6TUz/+o+CTlThRaT+4=
X-Face: \}2`P"_@pS86<'EM:'b.Ml}8IuMK"pV"?FReF$'c.S%u9<Q#U*4QO)$l81M`{Q/n
XL'`91kd%N::LG:=*\35JS0prp\VJN^<s"b#bff@fA7]5lJA.jn,x_d%Md$,{.EZ
 by: vallor - Wed, 16 Aug 2023 06:34 UTC

On Tue, 15 Aug 2023 19:50:44 +0100, Richard Harnden
<richard.nospam@gmail.com> wrote in <ubghe4$2ubhu$1@dont-email.me>:

> On 15/08/2023 14:34, David Brown wrote:
>> On 15/08/2023 09:50, Richard Kettlewell wrote:
>>> Kaz Kylheku <864-117-4973@kylheku.com> writes:
>>>> On 2023-08-15, Gary R. Schmidt <grschmidt@acm.org> wrote:
>>>>> Ahah!  You don't have users, do you?
>>>>>
>>>>> No doubt you also don't encounter filenames with spaces in them, or
>>>>> carriage returns, or other garbage.
>>>>
>>>> The interesction of:
>>>>
>>>> - Users who make filenames like "-foo" and "monthly forecast.xls"
>>>>
>>>> - Users who sit in a POSIX shell expanding wildcards like *
>>>>    in the same directory.
>>>>
>>>> is probababy vanishingly nil, and the subset of those who do the
>>>> above in the same directory is even smaller.
>>>
>>> The cases I’ve encountered are where someone accidentally creates a
>>> file with a weird name (starts with - or whatever) and then has
>>> trouble deleting it. I don’t think they got as far as having accidents
>>> with wildcards in the cases I remember, but the basic setup of a file
>>> with a ridiculous name and a non-expert user does happen occasionally.
>>>
>>>
>> It's usually sufficient just to put the awkward name inside quotation
>> marks.
>>
>>
>>
> But people won't/don't do that.
>
> Also:
>
> $ >-f $ >-r $ rm *
>
> How to safely cater for all 'weird' inputs?

(wondering if this belongs in comp.unix.shell, but here goes:)

In the 90's and maybe the early 2000's, many of our
(large installation) servers had a '-i' file in their
root directories. I'm not sure how widespread the
practice was, but I don't think we invented it.

--
-v

Re: Piping to stdin

<ubi1ij$37upp$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9886&group=comp.unix.programmer#9886

  copy link   Newsgroups: comp.unix.programmer comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: richard....@gmail.com (Richard Harnden)
Newsgroups: comp.unix.programmer,comp.lang.c
Subject: Re: Piping to stdin
Date: Wed, 16 Aug 2023 09:32:19 +0100
Organization: A noiseless patient Spider
Lines: 49
Message-ID: <ubi1ij$37upp$1@dont-email.me>
References: <9e7a4bd1-bfbb-4df7-af1a-27ca9625e50bn@googlegroups.com>
<LtQSo3SOOU09AXJ1X@bongo-ra.co> <ubbua5$3hium$1@news.xmission.com>
<20230813200644.979@kylheku.com> <ubc63c$3hlul$2@news.xmission.com>
<ubdgcv$2carp$2@dont-email.me> <vo5rqj-lpl.ln1@paranoia.mcleod-schmidt.id.au>
<20230814215312.550@kylheku.com> <1by1ic2n67.fsf@pfeifferfamily.net>
Reply-To: nospam.harnden@gmail.com
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 16 Aug 2023 08:32:19 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="ee8088279b252440a53acedb0073dea9";
logging-data="3406649"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/vp7akEKSqbHp9EnyxSlTt4QxKRF8oKUM="
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.14.0
Cancel-Lock: sha1:4Asc22F/fsvedSXZSiWLX52ZMt8=
In-Reply-To: <1by1ic2n67.fsf@pfeifferfamily.net>
 by: Richard Harnden - Wed, 16 Aug 2023 08:32 UTC

On 15/08/2023 19:08, Joe Pfeiffer wrote:
> Kaz Kylheku <864-117-4973@kylheku.com> writes:
>
>> On 2023-08-15, Gary R. Schmidt <grschmidt@acm.org> wrote:
>>> On 15/08/2023 01:14, Kalevi Kolttonen wrote:
>>>> In comp.unix.programmer Kenny McCormack <gazelle@shell.xmission.com> wrote:
>>>>> You know that - and I know that - but do they know that?
>>>>
>>>> It makes no difference. In the real world nobody has
>>>> files named '-'.
>>>>
>>>> br,
>>>> KK
>>>
>>> Ahah! You don't have users, do you?
>>>
>>> No doubt you also don't encounter filenames with spaces in them, or
>>> carriage returns, or other garbage.
>>
>> The interesction of:
>>
>> - Users who make filenames like "-foo" and "monthly forecast.xls"
>>
>> - Users who sit in a POSIX shell expanding wildcards like *
>> in the same directory.
>>
>> is probababy vanishingly nil, and the subset of those who do the
>> above in the same directory is even smaller.
>>
>> Now admin scripts do have to handle the files created by the goofy users
>> in the first category.
>>
>> Admin scripts don't ahve to worry about users creating a file
>> called -, because admin scripts won't be run in the directory
>> where the user did that. Not even scripts which do process
>> paths traversing that directory. The admin (or cron, or systemd or
>> whatever) will run those from somewhere else.
>
> Though I expect just about everyone has tried to run foo -xyz and
> inadvertently run foo - xyz instead, ending up with a file named - and
> one named xyz.

$ rm -rf * .tmp
rm: .tmp: No such file or directory
$ unrm
-ksh: unrm: not found
$ man cpio

Re: Piping to stdin

<ubib2o$394g8$5@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9887&group=comp.unix.programmer#9887

  copy link   Newsgroups: comp.unix.programmer comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.unix.programmer,comp.lang.c
Subject: Re: Piping to stdin
Date: Wed, 16 Aug 2023 13:14:32 +0200
Organization: A noiseless patient Spider
Lines: 43
Message-ID: <ubib2o$394g8$5@dont-email.me>
References: <9e7a4bd1-bfbb-4df7-af1a-27ca9625e50bn@googlegroups.com>
<LtQSo3SOOU09AXJ1X@bongo-ra.co> <ubbua5$3hium$1@news.xmission.com>
<20230813200644.979@kylheku.com> <ubc63c$3hlul$2@news.xmission.com>
<ubdgcv$2carp$2@dont-email.me> <vo5rqj-lpl.ln1@paranoia.mcleod-schmidt.id.au>
<20230814215312.550@kylheku.com> <wwvleeceobt.fsf@LkoBDZeT.terraraq.uk>
<ubhnad$36om0$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 16 Aug 2023 11:14:32 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="31f88dcb6b6bb39d1a90cf8e0c2a62fe";
logging-data="3445256"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX183HOxZz05YkWwSvNikYcdTlRUBV/jr0BQ="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.9.0
Cancel-Lock: sha1:dtU6GoDoePNCejQbgdpaRJ3R24c=
Content-Language: en-GB
In-Reply-To: <ubhnad$36om0$1@dont-email.me>
 by: David Brown - Wed, 16 Aug 2023 11:14 UTC

On 16/08/2023 07:37, James Kuyper wrote:
> On 8/15/23 03:50, Richard Kettlewell wrote:
>> Kaz Kylheku <864-117-4973@kylheku.com> writes:
> ...
>>> The interesction of:
>>>
>>> - Users who make filenames like "-foo" and "monthly forecast.xls"
>>>
>>> - Users who sit in a POSIX shell expanding wildcards like *
>>> in the same directory.
>>>
>>> is probababy vanishingly nil, and the subset of those who do the
>>> above in the same directory is even smaller.
>>
>> The cases I’ve encountered are where someone accidentally creates a file
>> with a weird name (starts with - or whatever) and then has trouble
>> deleting it. I don’t think they got as far as having accidents with
>> wildcards in the cases I remember, but the basic setup of a file with a
>> ridiculous name and a non-expert user does happen occasionally.
>
> The most bizarre filenames I've seen were generally created by one of
> two mechanisms: Copy-and-pasting a command line into a terminal window,
> where a minor slip of the mouse resulted in the copy including far more
> material than it was supposed to. Most of the resulting lines of text do
> nothing, but every once in a while a line starts with a word that is a
> valid unix command name, and some very weird things happen.
>
> The second scenario is where someone stupidly gave an ordinary text file
> execute permission, and someone else accidentally typed the name of that
> file in a context where it would invoke the supposed "executable". The
> results were similar to those from the copy-and-past problem, except
> that some of the text files were much longer, increasing the chance of a
> line from the file actually resulting in non-trivial behavior.

I have seen some odd names on file servers, when people have tried to
make certain files sort at the top or bottom of a list by prefixing with
odd characters (such as a space - that's always fun).

Many punctuation marks that are easy to use in gui programs are awkward
on the command line - brackets, quotation marks, ampersand, etc. Mostly
you can handle them on the command line by using quotation marks, or
backslash escapes.

Re: Piping to stdin

<87fs4j2i27.fsf@fatphil.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9888&group=comp.unix.programmer#9888

  copy link   Newsgroups: comp.unix.programmer comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: pc+use...@asdf.org (Phil Carmody)
Newsgroups: comp.unix.programmer,comp.lang.c
Subject: Re: Piping to stdin
Date: Wed, 16 Aug 2023 17:11:28 +0300
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <87fs4j2i27.fsf@fatphil.org>
References: <9e7a4bd1-bfbb-4df7-af1a-27ca9625e50bn@googlegroups.com>
<vo5rqj-lpl.ln1@paranoia.mcleod-schmidt.id.au>
<ubg25m$2rr3g$1@dont-email.me> <ubg4no$8kb$1@milena.home.net.it>
<ubg6o7$3jrsn$1@news.xmission.com> <ubg853$2ssj8$1@dont-email.me>
<87sf8k2gw3.fsf@fatphil.org> <ubgoee$2rs7p$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="1b3a9e5cff33772e3b5b11700c1cdfef";
logging-data="3498711"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18n9qrG1h+8+KiIUA+scaij"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Cancel-Lock: sha1:CkcyTRmPpVJHNvo4kFs8CXLJZkc=
sha1:GoXShi1zl04yVIT2hA6BMTTMRKA=
 by: Phil Carmody - Wed, 16 Aug 2023 14:11 UTC

Lew Pitcher <lew.pitcher@digitalfreehold.ca> writes:
> On Tue, 15 Aug 2023 23:24:28 +0300, Phil Carmody wrote:
>> kalevi@kolttonen.fi (Kalevi Kolttonen) writes:
>>> Kenny McCormack <gazelle@shell.xmission.com> wrote:
>>>> But do they know that???
>>>
>>> "They" probably don't know it. But let's face it,
>>> nobody really wants to create a file having '-'
>>> filename on purpose. The filename is not descriptive
>>> at all, it would be just an insane choice for anything
>>> useful.
>>>
>>> It could happen by accident, but even that is quite
>>> unlikely.
>>>
>>> If "they" don't know how to delete it, there is no need
>>> to panic. The file's existence does no harm. "They" can
>>> always ask for help and someone will tell them how
>>> to get rid of it.
>>>
>>> I guess the stdin convention '-' is decades old.
>>> It was chosen because they had pick something that
>>> is short and not likely to exist as a real file.
>>
>> I propose that '|' might have been better - it's even mnemonic.
>
> But, '|' conflicts with the shell pipe character, and would need
> a workaround in some cases. For example,

It's doing something special, why wouldn't you expect to do something
special to make use of it?

Phil
--
We are no longer hunters and nomads. No longer awed and frightened, as we have
gained some understanding of the world in which we live. As such, we can cast
aside childish remnants from the dawn of our civilization.
-- NotSanguine on SoylentNews, after Eugen Weber in /The Western Tradition/

Re: Piping to stdin

<878rab2hbb.fsf@fatphil.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9889&group=comp.unix.programmer#9889

  copy link   Newsgroups: comp.unix.programmer comp.lang.c
Path: i2pn2.org!rocksolid2!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: pc+use...@asdf.org (Phil Carmody)
Newsgroups: comp.unix.programmer,comp.lang.c
Subject: Re: Piping to stdin
Date: Wed, 16 Aug 2023 17:27:36 +0300
Organization: A noiseless patient Spider
Lines: 62
Message-ID: <878rab2hbb.fsf@fatphil.org>
References: <9e7a4bd1-bfbb-4df7-af1a-27ca9625e50bn@googlegroups.com>
<LtQSo3SOOU09AXJ1X@bongo-ra.co> <ubbua5$3hium$1@news.xmission.com>
<20230813200644.979@kylheku.com> <ubc63c$3hlul$2@news.xmission.com>
<ubdgcv$2carp$2@dont-email.me>
<vo5rqj-lpl.ln1@paranoia.mcleod-schmidt.id.au>
<20230814215312.550@kylheku.com> <1by1ic2n67.fsf@pfeifferfamily.net>
<ubi1ij$37upp$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="1b3a9e5cff33772e3b5b11700c1cdfef";
logging-data="3510469"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19IND7PYppG2xCAqUSnGnvW"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Cancel-Lock: sha1:ocH+OWEACHYuZfIK8Fud8yKFeDQ=
sha1:Rm6P6NXNkkIvNRQ0ARK5PpZECWE=
 by: Phil Carmody - Wed, 16 Aug 2023 14:27 UTC

Richard Harnden <richard.nospam@gmail.com> writes:
> On 15/08/2023 19:08, Joe Pfeiffer wrote:
>> Kaz Kylheku <864-117-4973@kylheku.com> writes:
>>> On 2023-08-15, Gary R. Schmidt <grschmidt@acm.org> wrote:
>>>> On 15/08/2023 01:14, Kalevi Kolttonen wrote:
>>>>> In comp.unix.programmer Kenny McCormack <gazelle@shell.xmission.com> wrote:
>>>>>> You know that - and I know that - but do they know that?
>>>>>
>>>>> It makes no difference. In the real world nobody has
>>>>> files named '-'.
>>>>>
>>>>> br,
>>>>> KK
>>>>
>>>> Ahah! You don't have users, do you?
>>>>
>>>> No doubt you also don't encounter filenames with spaces in them, or
>>>> carriage returns, or other garbage.
>>>
>>> The interesction of:
>>>
>>> - Users who make filenames like "-foo" and "monthly forecast.xls"
>>>
>>> - Users who sit in a POSIX shell expanding wildcards like *
>>> in the same directory.
>>>
>>> is probababy vanishingly nil, and the subset of those who do the
>>> above in the same directory is even smaller.
>>>
>>> Now admin scripts do have to handle the files created by the goofy users
>>> in the first category.
>>>
>>> Admin scripts don't ahve to worry about users creating a file
>>> called -, because admin scripts won't be run in the directory
>>> where the user did that. Not even scripts which do process
>>> paths traversing that directory. The admin (or cron, or systemd or
>>> whatever) will run those from somewhere else.
>>
>> Though I expect just about everyone has tried to run foo -xyz and
>> inadvertently run foo - xyz instead, ending up with a file named - and
>> one named xyz.
>
> $ rm -rf * .tmp
> rm: .tmp: No such file or directory
> $ unrm
> -ksh: unrm: not found
> $ man cpio

Spurious spaces are less common than this mistake, which I have seen
done by someone (who was at elevated privs at the time):

# rm *>o

(For those in exotic-keyboard-land: '>' was shifted '.', thus the
shift required for '*' hadn't been released yet.)

Phil
--
We are no longer hunters and nomads. No longer awed and frightened, as we have
gained some understanding of the world in which we live. As such, we can cast
aside childish remnants from the dawn of our civilization.
-- NotSanguine on SoylentNews, after Eugen Weber in /The Western Tradition/

Re: Piping to stdin

<ubipom$3ajkp$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9890&group=comp.unix.programmer#9890

  copy link   Newsgroups: comp.unix.programmer comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: lew.pitc...@digitalfreehold.ca (Lew Pitcher)
Newsgroups: comp.unix.programmer,comp.lang.c
Subject: Re: Piping to stdin
Date: Wed, 16 Aug 2023 15:25:10 -0000 (UTC)
Organization: The Pitcher Digital Freehold
Lines: 26
Message-ID: <ubipom$3ajkp$1@dont-email.me>
References: <9e7a4bd1-bfbb-4df7-af1a-27ca9625e50bn@googlegroups.com>
<vo5rqj-lpl.ln1@paranoia.mcleod-schmidt.id.au>
<ubg25m$2rr3g$1@dont-email.me> <ubg4no$8kb$1@milena.home.net.it>
<ubg6o7$3jrsn$1@news.xmission.com> <ubg853$2ssj8$1@dont-email.me>
<87sf8k2gw3.fsf@fatphil.org> <ubgoee$2rs7p$1@dont-email.me>
<87fs4j2i27.fsf@fatphil.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 16 Aug 2023 15:25:10 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="b581253026a9998bab917224ced56283";
logging-data="3493529"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+GyatAJKwzk2bJkxpd61cE4NGM0Nsx6h4="
User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508
git://git.gnome.org/pan2)
Cancel-Lock: sha1:ToMVshA2I+nKsIeIu9QvQrSbxWk=
 by: Lew Pitcher - Wed, 16 Aug 2023 15:25 UTC

On Wed, 16 Aug 2023 17:11:28 +0300, Phil Carmody wrote:

> Lew Pitcher <lew.pitcher@digitalfreehold.ca> writes:
>> On Tue, 15 Aug 2023 23:24:28 +0300, Phil Carmody wrote:
[snip]
>>>> I guess the stdin convention '-' is decades old.
>>>> It was chosen because they had pick something that
>>>> is short and not likely to exist as a real file.
>>>
>>> I propose that '|' might have been better - it's even mnemonic.
>>
>> But, '|' conflicts with the shell pipe character, and would need
>> a workaround in some cases. For example,
>
> It's doing something special, why wouldn't you expect to do something
> special to make use of it?

Okay, then. How about a counter proposal:
For Unix shells, the < character indicates redirection of stdin.
I propose that '<' might have been a better choice as a standard
program option to flag "read from stdin" than either '|' /or/ '-'
were. :-)

--
Lew Pitcher
"In Skills We Trust"

Re: Piping to stdin

<wwvr0o3j618.fsf@LkoBDZeT.terraraq.uk>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9892&group=comp.unix.programmer#9892

  copy link   Newsgroups: comp.unix.programmer comp.lang.c
Path: i2pn2.org!i2pn.org!news.niel.me!news.gegeweb.eu!gegeweb.org!nntp.terraraq.uk!.POSTED.tunnel.sfere.anjou.terraraq.org.uk!not-for-mail
From: inva...@invalid.invalid (Richard Kettlewell)
Newsgroups: comp.unix.programmer,comp.lang.c
Subject: Re: Piping to stdin
Date: Wed, 16 Aug 2023 17:39:15 +0100
Organization: terraraq NNTP server
Message-ID: <wwvr0o3j618.fsf@LkoBDZeT.terraraq.uk>
References: <9e7a4bd1-bfbb-4df7-af1a-27ca9625e50bn@googlegroups.com>
<LtQSo3SOOU09AXJ1X@bongo-ra.co> <ubbua5$3hium$1@news.xmission.com>
<20230813200644.979@kylheku.com> <ubc63c$3hlul$2@news.xmission.com>
<ubdgcv$2carp$2@dont-email.me>
<vo5rqj-lpl.ln1@paranoia.mcleod-schmidt.id.au>
<20230814215312.550@kylheku.com>
<wwvleeceobt.fsf@LkoBDZeT.terraraq.uk> <ubfus8$2rc7s$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: innmantic.terraraq.uk; posting-host="tunnel.sfere.anjou.terraraq.org.uk:172.17.207.6";
logging-data="58507"; mail-complaints-to="usenet@innmantic.terraraq.uk"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:E/pR2cX1rfd71eLlC5AJaLyA9tA=
X-Face: h[Hh-7npe<<b4/eW[]sat,I3O`t8A`(ej.H!F4\8|;ih)`7{@:A~/j1}gTt4e7-n*F?.Rl^
F<\{jehn7.KrO{!7=:(@J~]<.[{>v9!1<qZY,{EJxg6?Er4Y7Ng2\Ft>Z&W?r\c.!4DXH5PWpga"ha
+r0NzP?vnz:e/knOY)PI-
X-Boydie: NO
 by: Richard Kettlewell - Wed, 16 Aug 2023 16:39 UTC

David Brown <david.brown@hesbynett.no> writes:
> On 15/08/2023 09:50, Richard Kettlewell wrote:
>> The cases I’ve encountered are where someone accidentally creates a
>> file with a weird name (starts with - or whatever) and then has
>> trouble deleting it. I don’t think they got as far as having
>> accidents with wildcards in the cases I remember, but the basic setup
>> of a file with a ridiculous name and a non-expert user does happen
>> occasionally.
>
> It's usually sufficient just to put the awkward name inside quotation marks.

In the case we started with, quoting is not sufficient.

--
https://www.greenend.org.uk/rjk/

Re: Piping to stdin

<TP7DM.428701$U3w1.87269@fx09.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9894&group=comp.unix.programmer#9894

  copy link   Newsgroups: comp.unix.programmer comp.lang.c
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx09.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: Piping to stdin
Newsgroups: comp.unix.programmer,comp.lang.c
References: <9e7a4bd1-bfbb-4df7-af1a-27ca9625e50bn@googlegroups.com> <LtQSo3SOOU09AXJ1X@bongo-ra.co> <ubbua5$3hium$1@news.xmission.com> <20230813200644.979@kylheku.com> <ubc63c$3hlul$2@news.xmission.com> <ubdgcv$2carp$2@dont-email.me> <vo5rqj-lpl.ln1@paranoia.mcleod-schmidt.id.au> <20230814215312.550@kylheku.com> <wwvleeceobt.fsf@LkoBDZeT.terraraq.uk> <ubfus8$2rc7s$1@dont-email.me> <wwvr0o3j618.fsf@LkoBDZeT.terraraq.uk>
Lines: 17
Message-ID: <TP7DM.428701$U3w1.87269@fx09.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Wed, 16 Aug 2023 17:37:55 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Wed, 16 Aug 2023 17:37:55 GMT
X-Received-Bytes: 1765
 by: Scott Lurndal - Wed, 16 Aug 2023 17:37 UTC

Richard Kettlewell <invalid@invalid.invalid> writes:
>David Brown <david.brown@hesbynett.no> writes:
>> On 15/08/2023 09:50, Richard Kettlewell wrote:
>>> The cases I’ve encountered are where someone accidentally creates a
>>> file with a weird name (starts with - or whatever) and then has
>>> trouble deleting it. I don’t think they got as far as having
>>> accidents with wildcards in the cases I remember, but the basic setup
>>> of a file with a ridiculous name and a non-expert user does happen
>>> occasionally.
>>
>> It's usually sufficient just to put the awkward name inside quotation marks.
>
>In the case we started with, quoting is not sufficient.

Doesn't that depend on the type of quote? glob characters (*, ?) are
treated as regular characters in single quotes, for example.

Re: Piping to stdin

<ubj1rr$3l8k0$1@news.xmission.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9895&group=comp.unix.programmer#9895

  copy link   Newsgroups: comp.unix.programmer comp.lang.c
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!1.us.feeder.erje.net!2.us.feeder.erje.net!feeder.erje.net!news.snarked.org!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gaze...@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.unix.programmer,comp.lang.c
Subject: Re: Piping to stdin
Date: Wed, 16 Aug 2023 17:43:23 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <ubj1rr$3l8k0$1@news.xmission.com>
References: <9e7a4bd1-bfbb-4df7-af1a-27ca9625e50bn@googlegroups.com> <ubfus8$2rc7s$1@dont-email.me> <wwvr0o3j618.fsf@LkoBDZeT.terraraq.uk> <TP7DM.428701$U3w1.87269@fx09.iad>
Injection-Date: Wed, 16 Aug 2023 17:43:23 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="3842688"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Wed, 16 Aug 2023 17:43 UTC

In article <TP7DM.428701$U3w1.87269@fx09.iad>,
Scott Lurndal <slp53@pacbell.net> wrote:
>Richard Kettlewell <invalid@invalid.invalid> writes:
>>David Brown <david.brown@hesbynett.no> writes:
>>> On 15/08/2023 09:50, Richard Kettlewell wrote:
>>>> The cases Ive encountered are where someone accidentally creates a
>>>> file with a weird name (starts with - or whatever) and then has
>>>> trouble deleting it. I dont think they got as far as having
>>>> accidents with wildcards in the cases I remember, but the basic setup
>>>> of a file with a ridiculous name and a non-expert user does happen
>>>> occasionally.
>>>
>>> It's usually sufficient just to put the awkward name inside
>>> quotation marks.
>>
>>In the case we started with, quoting is not sufficient.
>
>Doesn't that depend on the type of quote? glob characters (*, ?) are
>treated as regular characters in single quotes, for example.

You're missing the point.

--
Treating the stock market indexes as general measures of the well-being of a
society is like treating your blood pressure as an indicator of health. The
higher, the better, right? In fact, a high stock market is good for the investor
class, but it means the rest of us are getting screwed better than ever.

Re: Piping to stdin

<kyILkVaWvmSRCpUf5@bongo-ra.co>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9897&group=comp.unix.programmer#9897

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: spi...@gmail.com (Spiros Bousbouras)
Newsgroups: comp.unix.programmer
Subject: Re: Piping to stdin
Date: Wed, 16 Aug 2023 19:22:38 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <kyILkVaWvmSRCpUf5@bongo-ra.co>
References: <9e7a4bd1-bfbb-4df7-af1a-27ca9625e50bn@googlegroups.com> <LtQSo3SOOU09AXJ1X@bongo-ra.co> <ubbua5$3hium$1@news.xmission.com>
<20230813200644.979@kylheku.com> <ubc63c$3hlul$2@news.xmission.com> <ubdgcv$2carp$2@dont-email.me>
<vo5rqj-lpl.ln1@paranoia.mcleod-schmidt.id.au> <20230814215312.550@kylheku.com> <wwvleeceobt.fsf@LkoBDZeT.terraraq.uk>
<ubfus8$2rc7s$1@dont-email.me> <wwvr0o3j618.fsf@LkoBDZeT.terraraq.uk> <TP7DM.428701$U3w1.87269@fx09.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 16 Aug 2023 19:22:38 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="4b4b6102ce975fa1e9b00493021a4372";
logging-data="3597770"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX188T6QW14eLMjKU4QsFGkWL"
Cancel-Lock: sha1:YrjAdpGqnPijzSOch7PdGJOIcns=
X-Organisation: Weyland-Yutani
X-Server-Commands: nowebcancel
In-Reply-To: <TP7DM.428701$U3w1.87269@fx09.iad>
 by: Spiros Bousbouras - Wed, 16 Aug 2023 19:22 UTC

On Wed, 16 Aug 2023 17:37:55 GMT
scott@slp53.sl.home (Scott Lurndal) wrote:
> Richard Kettlewell <invalid@invalid.invalid> writes:
> >David Brown <david.brown@hesbynett.no> writes:
> >> On 15/08/2023 09:50, Richard Kettlewell wrote:
> >>> The cases I’ve encountered are where someone accidentally creates a
> >>> file with a weird name (starts with - or whatever) and then has
> >>> trouble deleting it. I don’t think they got as far as having
> >>> accidents with wildcards in the cases I remember, but the basic setup
> >>> of a file with a ridiculous name and a non-expert user does happen
> >>> occasionally.
> >>
> >> It's usually sufficient just to put the awkward name inside quotation marks.
> >
> >In the case we started with, quoting is not sufficient.
>
> Doesn't that depend on the type of quote? glob characters (*, ?) are
> treated as regular characters in single quotes, for example.

The issue is whether a filename may be confused for an option if the
filename starts with - .Quoting isn't going to help with that.

Re: Piping to stdin

<20230816121355.702@kylheku.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9898&group=comp.unix.programmer#9898

  copy link   Newsgroups: comp.unix.programmer comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.unix.programmer,comp.lang.c
Subject: Re: Piping to stdin
Date: Wed, 16 Aug 2023 19:29:11 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 53
Message-ID: <20230816121355.702@kylheku.com>
References: <9e7a4bd1-bfbb-4df7-af1a-27ca9625e50bn@googlegroups.com>
<vo5rqj-lpl.ln1@paranoia.mcleod-schmidt.id.au>
<ubg25m$2rr3g$1@dont-email.me> <ubg4no$8kb$1@milena.home.net.it>
<ubg6o7$3jrsn$1@news.xmission.com> <ubg853$2ssj8$1@dont-email.me>
<87sf8k2gw3.fsf@fatphil.org> <ubgoee$2rs7p$1@dont-email.me>
<87fs4j2i27.fsf@fatphil.org> <ubipom$3ajkp$1@dont-email.me>
Injection-Date: Wed, 16 Aug 2023 19:29:11 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="d89b22cba778372e2da36441b02fe0e1";
logging-data="3599158"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Ng1zLMT6A43PSOp7azoVPo2MuEBy8wQ0="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:D4vmRTAOZF/pWJjNOVavyFGIzSE=
 by: Kaz Kylheku - Wed, 16 Aug 2023 19:29 UTC

On 2023-08-16, Lew Pitcher <lew.pitcher@digitalfreehold.ca> wrote:
> On Wed, 16 Aug 2023 17:11:28 +0300, Phil Carmody wrote:
>
>> Lew Pitcher <lew.pitcher@digitalfreehold.ca> writes:
>>> On Tue, 15 Aug 2023 23:24:28 +0300, Phil Carmody wrote:
> [snip]
>>>>> I guess the stdin convention '-' is decades old.
>>>>> It was chosen because they had pick something that
>>>>> is short and not likely to exist as a real file.
>>>>
>>>> I propose that '|' might have been better - it's even mnemonic.
>>>
>>> But, '|' conflicts with the shell pipe character, and would need
>>> a workaround in some cases. For example,
>>
>> It's doing something special, why wouldn't you expect to do something
>> special to make use of it?
>
> Okay, then. How about a counter proposal:
> For Unix shells, the < character indicates redirection of stdin.
> I propose that '<' might have been a better choice as a standard
> program option to flag "read from stdin" than either '|' /or/ '-'
> were. :-)

Counter-counter proposal #1:

The issue is that "commmand *" can generate the - name
or arguments that look like options.

But * skips things that begin with dot!

So, use that for options:

rm .rf *

Counter-couner proposal #2:

Problem is that we often operate on dot files.

Solution: have it so that * skips names that start with
dash; so if someone wants * to match - or -rf, they
must use "command -*".

Bash could have a "shopt -s dashglob" to make *
match dashed items.

I think it might be worth implementing dashglob Bash,
enabled by default.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Re: Piping to stdin

<20230816130509.951@kylheku.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9899&group=comp.unix.programmer#9899

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.unix.programmer
Subject: Re: Piping to stdin
Date: Wed, 16 Aug 2023 20:10:40 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <20230816130509.951@kylheku.com>
References: <9e7a4bd1-bfbb-4df7-af1a-27ca9625e50bn@googlegroups.com>
<LtQSo3SOOU09AXJ1X@bongo-ra.co> <ubbua5$3hium$1@news.xmission.com>
<20230813200644.979@kylheku.com> <ubc63c$3hlul$2@news.xmission.com>
<ubdgcv$2carp$2@dont-email.me>
<vo5rqj-lpl.ln1@paranoia.mcleod-schmidt.id.au>
<20230814215312.550@kylheku.com> <wwvleeceobt.fsf@LkoBDZeT.terraraq.uk>
<ubfus8$2rc7s$1@dont-email.me> <wwvr0o3j618.fsf@LkoBDZeT.terraraq.uk>
<TP7DM.428701$U3w1.87269@fx09.iad> <kyILkVaWvmSRCpUf5@bongo-ra.co>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 16 Aug 2023 20:10:40 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="d89b22cba778372e2da36441b02fe0e1";
logging-data="3608177"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/10uH4vG8S0gaZEBhQOhLwZ+pd75PRUdg="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:XSQ3oiZ+ZSyBA8ElmEufZKgw1Xk=
 by: Kaz Kylheku - Wed, 16 Aug 2023 20:10 UTC

On 2023-08-16, Spiros Bousbouras <spibou@gmail.com> wrote:
> On Wed, 16 Aug 2023 17:37:55 GMT
> scott@slp53.sl.home (Scott Lurndal) wrote:
>> Richard Kettlewell <invalid@invalid.invalid> writes:
>> >David Brown <david.brown@hesbynett.no> writes:
>> >> On 15/08/2023 09:50, Richard Kettlewell wrote:
>> >>> The cases I’ve encountered are where someone accidentally creates a
>> >>> file with a weird name (starts with - or whatever) and then has
>> >>> trouble deleting it. I don’t think they got as far as having
>> >>> accidents with wildcards in the cases I remember, but the basic setup
>> >>> of a file with a ridiculous name and a non-expert user does happen
>> >>> occasionally.
>> >>
>> >> It's usually sufficient just to put the awkward name inside quotation marks.
>> >
>> >In the case we started with, quoting is not sufficient.
>>
>> Doesn't that depend on the type of quote? glob characters (*, ?) are
>> treated as regular characters in single quotes, for example.
>
> The issue is whether a filename may be confused for an option if the
> filename starts with - .Quoting isn't going to help with that.

It does. There is a quoting mechanism -- which says "the following
arguments are literal even if they look like options".

It's a token-level quote. The "--" token escapes a following "-rf"
token, and others after it.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Re: Piping to stdin

<20230816131105.836@kylheku.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9900&group=comp.unix.programmer#9900

  copy link   Newsgroups: comp.unix.programmer
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.unix.programmer
Subject: Re: Piping to stdin
Date: Wed, 16 Aug 2023 20:11:27 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 37
Message-ID: <20230816131105.836@kylheku.com>
References: <9e7a4bd1-bfbb-4df7-af1a-27ca9625e50bn@googlegroups.com>
<LtQSo3SOOU09AXJ1X@bongo-ra.co> <ubbua5$3hium$1@news.xmission.com>
<20230813200644.979@kylheku.com> <ubc63c$3hlul$2@news.xmission.com>
<ubdgcv$2carp$2@dont-email.me>
<vo5rqj-lpl.ln1@paranoia.mcleod-schmidt.id.au>
<20230814215312.550@kylheku.com> <wwvleeceobt.fsf@LkoBDZeT.terraraq.uk>
<ubfus8$2rc7s$1@dont-email.me> <wwvr0o3j618.fsf@LkoBDZeT.terraraq.uk>
<TP7DM.428701$U3w1.87269@fx09.iad> <kyILkVaWvmSRCpUf5@bongo-ra.co>
<20230816130509.951@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 16 Aug 2023 20:11:27 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="d89b22cba778372e2da36441b02fe0e1";
logging-data="3609949"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+zO7t/SS13qpSs9P7LLCs0aTyn/j8txw4="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:C0/bmxjbdUHQjy4D0ZWWU3IWSIo=
 by: Kaz Kylheku - Wed, 16 Aug 2023 20:11 UTC

On 2023-08-16, Kaz Kylheku <864-117-4973@kylheku.com> wrote:
> On 2023-08-16, Spiros Bousbouras <spibou@gmail.com> wrote:
>> On Wed, 16 Aug 2023 17:37:55 GMT
>> scott@slp53.sl.home (Scott Lurndal) wrote:
>>> Richard Kettlewell <invalid@invalid.invalid> writes:
>>> >David Brown <david.brown@hesbynett.no> writes:
>>> >> On 15/08/2023 09:50, Richard Kettlewell wrote:
>>> >>> The cases I’ve encountered are where someone accidentally creates a
>>> >>> file with a weird name (starts with - or whatever) and then has
>>> >>> trouble deleting it. I don’t think they got as far as having
>>> >>> accidents with wildcards in the cases I remember, but the basic setup
>>> >>> of a file with a ridiculous name and a non-expert user does happen
>>> >>> occasionally.
>>> >>
>>> >> It's usually sufficient just to put the awkward name inside quotation marks.
>>> >
>>> >In the case we started with, quoting is not sufficient.
>>>
>>> Doesn't that depend on the type of quote? glob characters (*, ?) are
>>> treated as regular characters in single quotes, for example.
>>
>> The issue is whether a filename may be confused for an option if the
>> filename starts with - .Quoting isn't going to help with that.
>
> It does. There is a quoting mechanism -- which says "the following
> arguments are literal even if they look like options".
>
> It's a token-level quote. The "--" token escapes a following "-rf"
> token, and others after it.

Ah, but of course, that is of no help with -, which is a non-option
argument.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

Re: Piping to stdin

<877cpulo80.fsf@nosuchdomain.example.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9902&group=comp.unix.programmer#9902

  copy link   Newsgroups: comp.unix.programmer comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith.S....@gmail.com (Keith Thompson)
Newsgroups: comp.unix.programmer,comp.lang.c
Subject: Re: Piping to stdin
Date: Wed, 16 Aug 2023 13:35:43 -0700
Organization: None to speak of
Lines: 36
Message-ID: <877cpulo80.fsf@nosuchdomain.example.com>
References: <9e7a4bd1-bfbb-4df7-af1a-27ca9625e50bn@googlegroups.com>
<LtQSo3SOOU09AXJ1X@bongo-ra.co> <ubbua5$3hium$1@news.xmission.com>
<20230813200644.979@kylheku.com> <ubc63c$3hlul$2@news.xmission.com>
<ubdgcv$2carp$2@dont-email.me>
<vo5rqj-lpl.ln1@paranoia.mcleod-schmidt.id.au>
<20230814215312.550@kylheku.com>
<wwvleeceobt.fsf@LkoBDZeT.terraraq.uk> <ubfus8$2rc7s$1@dont-email.me>
<wwvr0o3j618.fsf@LkoBDZeT.terraraq.uk>
<TP7DM.428701$U3w1.87269@fx09.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="15135efa85b793336b66170ecb85b528";
logging-data="3599848"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+J2cp/B42qxgVtBAZNBOVl"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock: sha1:Kw/zCe4z2CUezQfFOiRFYK/buAM=
sha1:3c5qkgqSycUeovZC/nCcizix5IY=
 by: Keith Thompson - Wed, 16 Aug 2023 20:35 UTC

scott@slp53.sl.home (Scott Lurndal) writes:
> Richard Kettlewell <invalid@invalid.invalid> writes:
>>David Brown <david.brown@hesbynett.no> writes:
>>> On 15/08/2023 09:50, Richard Kettlewell wrote:
>>>> The cases I’ve encountered are where someone accidentally creates a
>>>> file with a weird name (starts with - or whatever) and then has
>>>> trouble deleting it. I don’t think they got as far as having
>>>> accidents with wildcards in the cases I remember, but the basic setup
>>>> of a file with a ridiculous name and a non-expert user does happen
>>>> occasionally.
>>>
>>> It's usually sufficient just to put the awkward name inside quotation marks.
>>
>>In the case we started with, quoting is not sufficient.
>
> Doesn't that depend on the type of quote? glob characters (*, ?) are
> treated as regular characters in single quotes, for example.

Not in this case -- and glob characters are not expanded in either
single or doublle quotes.

The difference is that * and ? are expanded by the shell, so the
invoked command never sees them, but arguments starting with -
are treated specially by the command itself.

If you have a file named *, you can delete it with `rm '*'` or
`rm "*"`, or `rm \*`.

If you have a file named -r, you can delete it with `rm ./-r`, or
`rm -- -r` if your rm implementation supports that (POSIX doesn't
specify it).

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Will write code for food.
void Void(void) { Void(); } /* The recursive call of the void */

Re: Piping to stdin

<ubksl2$3o8ao$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9906&group=comp.unix.programmer#9906

  copy link   Newsgroups: comp.unix.programmer comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Mutt...@dastardlyhq.com
Newsgroups: comp.unix.programmer,comp.lang.c
Subject: Re: Piping to stdin
Date: Thu, 17 Aug 2023 10:26:42 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 29
Message-ID: <ubksl2$3o8ao$1@dont-email.me>
References: <9e7a4bd1-bfbb-4df7-af1a-27ca9625e50bn@googlegroups.com> <vo5rqj-lpl.ln1@paranoia.mcleod-schmidt.id.au> <ubg25m$2rr3g$1@dont-email.me> <ubg4no$8kb$1@milena.home.net.it> <ubg6o7$3jrsn$1@news.xmission.com> <ubg853$2ssj8$1@dont-email.me> <ubg8a8$2t20l$1@dont-email.me> <ubg8no$2t2as$1@dont-email.me>
Injection-Date: Thu, 17 Aug 2023 10:26:42 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c22366ece291fcc511ce050dc38e085e";
logging-data="3940696"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Xj9ycP8TDqWkC1RWL9V+P"
Cancel-Lock: sha1:E1WlrSmvDidCzSI/j8o0D1jjdAU=
 by: Mutt...@dastardlyhq.com - Thu, 17 Aug 2023 10:26 UTC

On Tue, 15 Aug 2023 16:22:16 -0000 (UTC)
kalevi@kolttonen.fi (Kalevi Kolttonen) wrote:
>In comp.unix.programmer Muttley@dastardlyhq.com wrote:
>> On Tue, 15 Aug 2023 16:12:19 -0000 (UTC)
>> kalevi@kolttonen.fi (Kalevi Kolttonen) wrote:
>>>Kenny McCormack <gazelle@shell.xmission.com> wrote:
>>>> But do they know that???
>>>
>>>"They" probably don't know it. But let's face it,
>>>nobody really wants to create a file having '-'
>>>filename on purpose. The filename is not descriptive
>>>at all, it would be just an insane choice for anything
>>>useful.
>>
>> I used to think the same thing about spaces in filenames. Then along came
>> Windows.
>
>Filenames having spaces versus the stdin convention '-' is
>comparing two things that are very different.
>
>The first one is just a way to name files or directories.
>
>The second one is an age-old Unix convention that has
>nothing to do with naming real files or directories.
>
>It is best to not to confuse these two distinct ideas.

They both cause problems.


devel / comp.unix.programmer / Re: Piping to stdin

Pages:1234
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor