Path: csiph.com!news.swapon.de!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: 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> <20230813200644.979@kylheku.com> <20230814215312.550@kylheku.com> 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= Xref: csiph.com comp.unix.programmer:14363 comp.lang.c:172409 scott@slp53.sl.home (Scott Lurndal) writes: > Richard Kettlewell writes: >>David Brown 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 */