Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #172150 > unrolled thread
| Started by | Malcolm McLean <malcolm.arthur.mclean@gmail.com> |
|---|---|
| First post | 2023-08-13 06:42 -0700 |
| Last post | 2023-08-14 21:14 +0000 |
| Articles | 20 on this page of 102 — 27 participants |
Back to article view | Back to comp.lang.c
Piping to stdin Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2023-08-13 06:42 -0700
Re: Piping to stdin Spiros Bousbouras <spibou@gmail.com> - 2023-08-13 13:55 +0000
Re: Piping to stdin Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2023-08-13 07:07 -0700
Re: Piping to stdin Bart <bc@freeuk.com> - 2023-08-13 15:21 +0100
Re: Piping to stdin Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2023-08-13 07:31 -0700
Re: Piping to stdin Bart <bc@freeuk.com> - 2023-08-13 16:40 +0100
Re: Piping to stdin scott@slp53.sl.home (Scott Lurndal) - 2023-08-13 16:08 +0000
Re: Piping to stdin scott@slp53.sl.home (Scott Lurndal) - 2023-08-13 16:07 +0000
Re: Piping to stdin Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2023-08-13 17:26 +0000
Re: Piping to stdin Kaz Kylheku <864-117-4973@kylheku.com> - 2023-08-13 19:09 +0000
Re: Piping to stdin scott@slp53.sl.home (Scott Lurndal) - 2023-08-13 20:45 +0000
Re: Piping to stdin Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-08-13 20:53 +0100
Re: Piping to stdin scott@slp53.sl.home (Scott Lurndal) - 2023-08-13 20:47 +0000
Re: Piping to stdin gazelle@shell.xmission.com (Kenny McCormack) - 2023-08-14 00:59 +0000
Re: Piping to stdin Kaz Kylheku <864-117-4973@kylheku.com> - 2023-08-14 03:07 +0000
Re: Piping to stdin gazelle@shell.xmission.com (Kenny McCormack) - 2023-08-14 03:12 +0000
Re: Piping to stdin kalevi@kolttonen.fi (Kalevi Kolttonen) - 2023-08-14 15:14 +0000
Re: Piping to stdin "Gary R. Schmidt" <grschmidt@acm.org> - 2023-08-15 12:50 +1000
Re: Piping to stdin Kaz Kylheku <864-117-4973@kylheku.com> - 2023-08-15 04:59 +0000
Re: Piping to stdin Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-08-14 23:15 -0700
Re: Piping to stdin Richard Kettlewell <invalid@invalid.invalid> - 2023-08-15 08:50 +0100
Dealing with weird filenames (Was: Piping to stdin) gazelle@shell.xmission.com (Kenny McCormack) - 2023-08-15 08:10 +0000
Re: Piping to stdin David Brown <david.brown@hesbynett.no> - 2023-08-15 15:34 +0200
Re: Piping to stdin Richard Harnden <richard.nospam@gmail.com> - 2023-08-15 19:50 +0100
Re: Piping to stdin scott@slp53.sl.home (Scott Lurndal) - 2023-08-15 20:16 +0000
Re: Piping to stdin vallor <vallor@cultnix.org> - 2023-08-16 06:34 +0000
Re: Piping to stdin Richard Kettlewell <invalid@invalid.invalid> - 2023-08-16 17:39 +0100
Re: Piping to stdin scott@slp53.sl.home (Scott Lurndal) - 2023-08-16 17:37 +0000
Re: Piping to stdin gazelle@shell.xmission.com (Kenny McCormack) - 2023-08-16 17:43 +0000
Re: Piping to stdin Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-08-16 13:35 -0700
Re: Piping to stdin Phil Carmody <pc+usenet@asdf.org> - 2023-08-17 14:51 +0300
Re: Piping to stdin James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-08-16 01:37 -0400
Re: Piping to stdin David Brown <david.brown@hesbynett.no> - 2023-08-16 13:14 +0200
Re: Piping to stdin Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2023-08-15 12:08 -0600
Re: Piping to stdin Richard Harnden <richard.nospam@gmail.com> - 2023-08-16 09:32 +0100
Re: Piping to stdin Phil Carmody <pc+usenet@asdf.org> - 2023-08-16 17:27 +0300
Re: Piping to stdin kalevi@kolttonen.fi (Kalevi Kolttonen) - 2023-08-15 14:30 +0000
Re: Piping to stdin Giovanni <lsodgf0@home.net.it> - 2023-08-15 17:14 +0200
Re: Piping to stdin gazelle@shell.xmission.com (Kenny McCormack) - 2023-08-15 15:48 +0000
Re: Piping to stdin kalevi@kolttonen.fi (Kalevi Kolttonen) - 2023-08-15 16:12 +0000
Re: Piping to stdin Muttley@dastardlyhq.com - 2023-08-15 16:15 +0000
Re: Piping to stdin kalevi@kolttonen.fi (Kalevi Kolttonen) - 2023-08-15 16:22 +0000
Re: Piping to stdin Muttley@dastardlyhq.com - 2023-08-17 10:26 +0000
Re: Piping to stdin kalevi@kolttonen.fi (Kalevi Kolttonen) - 2023-08-17 14:23 +0000
Re: Piping to stdin scott@slp53.sl.home (Scott Lurndal) - 2023-08-17 15:25 +0000
Re: Piping to stdin Kaz Kylheku <864-117-4973@kylheku.com> - 2023-08-15 17:33 +0000
Re: Piping to stdin Phil Carmody <pc+usenet@asdf.org> - 2023-08-15 23:32 +0300
Re: Piping to stdin Muttley@dastardlyhq.com - 2023-08-17 10:32 +0000
Re: Piping to stdin Phil Carmody <pc+usenet@asdf.org> - 2023-08-17 14:57 +0300
Re: Piping to stdin Michael S <already5chosen@yahoo.com> - 2023-08-17 05:14 -0700
Wrecking a good thing? (Was: Piping to stdin) gazelle@shell.xmission.com (Kenny McCormack) - 2023-08-17 14:09 +0000
Re: Wrecking a good thing? Phil Carmody <pc+usenet@asdf.org> - 2023-08-18 00:39 +0300
Re: Wrecking a good thing? (Was: Piping to stdin) David Brown <david.brown@hesbynett.no> - 2023-08-18 11:17 +0200
Re: Piping to stdin Muttley@dastardlyhq.com - 2023-08-17 15:14 +0000
Re: Piping to stdin Öö Tiib <ootiib@hot.ee> - 2023-08-17 08:58 -0700
Re: Piping to stdin Kaz Kylheku <864-117-4973@kylheku.com> - 2023-08-17 13:52 +0000
Re: Piping to stdin Muttley@dastardlyhq.com - 2023-08-17 15:20 +0000
Re: Piping to stdin Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-08-17 13:43 -0700
Re: Piping to stdin David Brown <david.brown@hesbynett.no> - 2023-08-18 11:28 +0200
Re: Piping to stdin Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-08-17 21:52 +0100
Re: Piping to stdin Phil Carmody <pc+usenet@asdf.org> - 2023-08-19 13:33 +0300
Re: Piping to stdin Oğuz <oguzismailuysal@gmail.com> - 2023-08-19 16:15 +0300
Re: Piping to stdin Muttley@dastardlyhq.com - 2023-08-19 14:48 +0000
Re: Piping to stdin scott@slp53.sl.home (Scott Lurndal) - 2023-08-20 17:24 +0000
Re: Piping to stdin Muttley@dastardlyhq.com - 2023-08-20 19:21 +0000
Re: Piping to stdin Rainer Weikusat <rweikusat@talktalk.net> - 2023-08-20 21:57 +0100
What language is this? (Was: Piping to stdin) gazelle@shell.xmission.com (Kenny McCormack) - 2023-08-20 22:33 +0000
Re: What language is this? (Was: Piping to stdin) scott@slp53.sl.home (Scott Lurndal) - 2023-08-21 01:26 +0000
Re: What language is this? (Was: Piping to stdin) gazelle@shell.xmission.com (Kenny McCormack) - 2023-08-21 02:57 +0000
Re: What language is this? Rainer Weikusat <rweikusat@talktalk.net> - 2023-08-21 17:16 +0100
Re: What language is this? gazelle@shell.xmission.com (Kenny McCormack) - 2023-08-21 19:10 +0000
Re: What language is this? Rainer Weikusat <rweikusat@talktalk.net> - 2023-08-21 20:31 +0100
Re: What language is this? gazelle@shell.xmission.com (Kenny McCormack) - 2023-08-21 20:29 +0000
Re: What language is this? Rainer Weikusat <rweikusat@talktalk.net> - 2023-08-21 21:48 +0100
Re: What language is this? (Was: Piping to stdin) Muttley@dastardlyhq.com - 2023-08-21 06:50 +0000
Re: Piping to stdin Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-08-19 21:14 +0100
Re: Piping to stdin Phil Carmody <pc+usenet@asdf.org> - 2023-08-15 23:24 +0300
Re: Piping to stdin Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2023-08-15 20:50 +0000
Re: Piping to stdin Phil Carmody <pc+usenet@asdf.org> - 2023-08-16 17:11 +0300
Re: Piping to stdin Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2023-08-16 15:25 +0000
Re: Piping to stdin Kaz Kylheku <864-117-4973@kylheku.com> - 2023-08-16 19:29 +0000
Re: Piping to stdin Phil Carmody <pc+usenet@asdf.org> - 2023-08-17 14:49 +0300
Re: Piping to stdin Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-08-16 03:20 +0100
Re: Piping to stdin Phil Carmody <pc+usenet@asdf.org> - 2023-08-15 18:33 +0300
Re: Piping to stdin "Nuno Silva" <nunojsilva@invalid.invalid> - 2023-08-14 09:45 +0100
Re: Piping to stdin scott@slp53.sl.home (Scott Lurndal) - 2023-08-13 16:06 +0000
Re: Piping to stdin Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-08-13 17:09 -0700
Re: Piping to stdin gazelle@shell.xmission.com (Kenny McCormack) - 2023-08-14 01:03 +0000
Re: Piping to stdin Kaz Kylheku <864-117-4973@kylheku.com> - 2023-08-14 04:00 +0000
Re: Piping to stdin Phil Carmody <pc+usenet@asdf.org> - 2023-08-14 12:20 +0300
Re: Piping to stdin Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-08-14 02:44 -0700
Re: Piping to stdin Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2023-08-14 03:54 -0700
Re: Piping to stdin gazelle@shell.xmission.com (Kenny McCormack) - 2023-08-14 11:22 +0000
Re: Piping to stdin Kaz Kylheku <864-117-4973@kylheku.com> - 2023-08-14 15:49 +0000
Re: Piping to stdin Ben Bacarisse <ben.usenet@bsb.me.uk> - 2023-08-14 17:19 +0100
Re: Piping to stdin Jim Jackson <jj@franjam.org.uk> - 2023-08-14 17:21 +0000
Re: Piping to stdin Michael S <already5chosen@yahoo.com> - 2023-08-15 08:02 -0700
Re: Piping to stdin John Forkosh <forkosh@panix.com> - 2023-08-14 03:15 +0000
Re: Piping to stdin gazelle@shell.xmission.com (Kenny McCormack) - 2023-08-14 11:28 +0000
Re: Piping to stdin scott@slp53.sl.home (Scott Lurndal) - 2023-08-14 15:41 +0000
Re: Piping to stdin Richard Harnden <richard.nospam@gmail.com> - 2023-08-14 22:02 +0100
Re: Piping to stdin scott@slp53.sl.home (Scott Lurndal) - 2023-08-14 21:14 +0000
Page 2 of 6 — ← Prev page 1 [2] 3 4 5 6 Next page →
| From | Richard Kettlewell <invalid@invalid.invalid> |
|---|---|
| Date | 2023-08-15 08:50 +0100 |
| Message-ID | <wwvleeceobt.fsf@LkoBDZeT.terraraq.uk> |
| In reply to | #172240 |
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. > 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. The usual example of an ‘admin script’ that has to deal with bizarre user-created file is a /tmp cleaner. Not quite the same issue as we started with here but depending on how experienced the script author is there is plenty of room for accidental or adversarial mischief. -- https://www.greenend.org.uk/rjk/
[toc] | [prev] | [next] | [standalone]
| From | gazelle@shell.xmission.com (Kenny McCormack) |
|---|---|
| Date | 2023-08-15 08:10 +0000 |
| Subject | Dealing with weird filenames (Was: Piping to stdin) |
| Message-ID | <ubfbu7$3ja4p$1@news.xmission.com> |
| In reply to | #172242 |
In article <wwvleeceobt.fsf@LkoBDZeT.terraraq.uk>, Richard Kettlewell <invalid@invalid.invalid> 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. This is a situation where using a GUI file manager (Windows Explorer equivalent - whatever they are calling it in Unix/Linux these days). Weirdly named files are no problem to delete from a GUI, since no shell is involved. -- If Jeb is Charlie Brown kicking a football-pulled-away, Mitt is a '50s housewife with a black eye who insists to her friends the roast wasn't dry.
[toc] | [prev] | [next] | [standalone]
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Date | 2023-08-15 15:34 +0200 |
| Message-ID | <ubfus8$2rc7s$1@dont-email.me> |
| In reply to | #172242 |
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.
[toc] | [prev] | [next] | [standalone]
| From | Richard Harnden <richard.nospam@gmail.com> |
|---|---|
| Date | 2023-08-15 19:50 +0100 |
| Message-ID | <ubghe4$2ubhu$1@dont-email.me> |
| In reply to | #172276 |
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?
[toc] | [prev] | [next] | [standalone]
| From | scott@slp53.sl.home (Scott Lurndal) |
|---|---|
| Date | 2023-08-15 20:16 +0000 |
| Message-ID | <o2RCM.110346$PlBb.53343@fx42.iad> |
| In reply to | #172321 |
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.
[toc] | [prev] | [next] | [standalone]
| From | vallor <vallor@cultnix.org> |
|---|---|
| Date | 2023-08-16 06:34 +0000 |
| Message-ID | <ubhqlo$374bv$1@dont-email.me> |
| In reply to | #172321 |
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
[toc] | [prev] | [next] | [standalone]
| From | Richard Kettlewell <invalid@invalid.invalid> |
|---|---|
| Date | 2023-08-16 17:39 +0100 |
| Message-ID | <wwvr0o3j618.fsf@LkoBDZeT.terraraq.uk> |
| In reply to | #172276 |
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/
[toc] | [prev] | [next] | [standalone]
| From | scott@slp53.sl.home (Scott Lurndal) |
|---|---|
| Date | 2023-08-16 17:37 +0000 |
| Message-ID | <TP7DM.428701$U3w1.87269@fx09.iad> |
| In reply to | #172387 |
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.
[toc] | [prev] | [next] | [standalone]
| From | gazelle@shell.xmission.com (Kenny McCormack) |
|---|---|
| Date | 2023-08-16 17:43 +0000 |
| Message-ID | <ubj1rr$3l8k0$1@news.xmission.com> |
| In reply to | #172397 |
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.
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <Keith.S.Thompson+u@gmail.com> |
|---|---|
| Date | 2023-08-16 13:35 -0700 |
| Message-ID | <877cpulo80.fsf@nosuchdomain.example.com> |
| In reply to | #172397 |
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 */
[toc] | [prev] | [next] | [standalone]
| From | Phil Carmody <pc+usenet@asdf.org> |
|---|---|
| Date | 2023-08-17 14:51 +0300 |
| Message-ID | <87y1i9zy1s.fsf@fatphil.org> |
| In reply to | #172397 |
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. No, it depends on the program you intend to pass the filename to, and how it treats its arguments. Which we don't know. So we can't say anything more at the moment. 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/
[toc] | [prev] | [next] | [standalone]
| From | James Kuyper <jameskuyper@alumni.caltech.edu> |
|---|---|
| Date | 2023-08-16 01:37 -0400 |
| Message-ID | <ubhnad$36om0$1@dont-email.me> |
| In reply to | #172242 |
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.
[toc] | [prev] | [next] | [standalone]
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Date | 2023-08-16 13:14 +0200 |
| Message-ID | <ubib2o$394g8$5@dont-email.me> |
| In reply to | #172350 |
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.
[toc] | [prev] | [next] | [standalone]
| From | Joe Pfeiffer <pfeiffer@cs.nmsu.edu> |
|---|---|
| Date | 2023-08-15 12:08 -0600 |
| Message-ID | <1by1ic2n67.fsf@pfeifferfamily.net> |
| In reply to | #172240 |
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.
[toc] | [prev] | [next] | [standalone]
| From | Richard Harnden <richard.nospam@gmail.com> |
|---|---|
| Date | 2023-08-16 09:32 +0100 |
| Message-ID | <ubi1ij$37upp$1@dont-email.me> |
| In reply to | #172320 |
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
[toc] | [prev] | [next] | [standalone]
| From | Phil Carmody <pc+usenet@asdf.org> |
|---|---|
| Date | 2023-08-16 17:27 +0300 |
| Message-ID | <878rab2hbb.fsf@fatphil.org> |
| In reply to | #172355 |
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/
[toc] | [prev] | [next] | [standalone]
| From | kalevi@kolttonen.fi (Kalevi Kolttonen) |
|---|---|
| Date | 2023-08-15 14:30 +0000 |
| Message-ID | <ubg25m$2rr3g$1@dont-email.me> |
| In reply to | #172239 |
In comp.unix.programmer Gary R. Schmidt <grschmidt@acm.org> wrote: > On 15/08/2023 01:14, Kalevi Kolttonen wrote: > Ahah! You don't have users, do you? No, I no longer have users. However, I used to have 50 000 - 60 000 users, but only a tiny minority of them had Unix shell access. The vast majority was email users. I certainly never ever encountered anyone with filename or email folder name being '-'. > No doubt you also don't encounter filenames with > spaces in them, or carriage returns, or other > garbage. That is a terrible and unjustified comparison as filenams with spaces are very common indeed. The "problem" of having '-' as a filename is a complete non-issue that only has theoretical interest. On Unix, no matter which stdin convention you choose, you run the risk of someone having that convention as a filename. On Unix, it used to be the case that only NUL-characters and '/' were out of question. I suppose some filesystems place more restrictions on filenames nowadays. br, KK
[toc] | [prev] | [next] | [standalone]
| From | Giovanni <lsodgf0@home.net.it> |
|---|---|
| Date | 2023-08-15 17:14 +0200 |
| Message-ID | <ubg4no$8kb$1@milena.home.net.it> |
| In reply to | #172283 |
On 8/15/23 16:30, Kalevi Kolttonen wrote: > On Unix, it used to be the case that only > NUL-characters and '/' were out of question. I > suppose some filesystems place more restrictions > on filenames nowadays. There are still no restriction on file names. It`s only a problem of the program. If it expects a file name as input, it has to test if the argument passed is - in which case it reads from stdin. And, usually, this works even if the file system has in the current directory a file named - To use the file - you should pass it to the program as ./- Ciao Giovanni -- A computer is like an air conditioner, it stops working when you open Windows. < https://giovanni.homelinux.net/ >
[toc] | [prev] | [next] | [standalone]
| From | gazelle@shell.xmission.com (Kenny McCormack) |
|---|---|
| Date | 2023-08-15 15:48 +0000 |
| Message-ID | <ubg6o7$3jrsn$1@news.xmission.com> |
| In reply to | #172294 |
In article <ubg4no$8kb$1@milena.home.net.it>, Giovanni <gfalzoni@inwind.it> wrote: >On 8/15/23 16:30, Kalevi Kolttonen wrote: >> On Unix, it used to be the case that only >> NUL-characters and '/' were out of question. I >> suppose some filesystems place more restrictions >> on filenames nowadays. > >There are still no restriction on file names. It`s only a problem of the >program. If it expects a file name as input, it has to test if the >argument passed is - in which case it reads from stdin. And, usually, >this works even if the file system has in the current directory a file >named - > >To use the file - you should pass it to the program as ./- Yes, as noted, you know that. And I know that. And even Kalevi knows that. But do they know that??? -- The randomly chosen signature file that would have appeared here is more than 4 lines long. As such, it violates one or more Usenet RFCs. In order to remain in compliance with said RFCs, the actual sig can be found at the following URL: http://user.xmission.com/~gazelle/Sigs/Aspergers
[toc] | [prev] | [next] | [standalone]
| From | kalevi@kolttonen.fi (Kalevi Kolttonen) |
|---|---|
| Date | 2023-08-15 16:12 +0000 |
| Message-ID | <ubg853$2ssj8$1@dont-email.me> |
| In reply to | #172302 |
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. br, KK
[toc] | [prev] | [next] | [standalone]
Page 2 of 6 — ← Prev page 1 [2] 3 4 5 6 Next page →
Back to top | Article view | comp.lang.c
csiph-web