Let me update this a little. When I said "professional", I should have said something like "power user" in today's vernacular. The shell is a field full of mines for those who are not familiar with it. I've been using Linux for about 20 years, and I still get tripped up at times with BASH. I didn't mean to disparage Mr. Mills. He know z/OS well. But the UNIX side is hard to get used to. Like when I went from a Xerox Sigma 7 using BPM to MVT using JCL. I said many nasty things about JCL. I finally, mainly, learned it.
On Thu, Nov 5, 2020 at 11:21 AM John McKown <john.archie.mck...@gmail.com> wrote: > Caution -- tacky in-line comment. > > On Thu, Nov 5, 2020 at 8:46 AM Charles Mills <charl...@mcn.org> wrote: > >> What the heck were the UNIX designers thinking when they allowed the >> casual creation of a filename of -x? > > > They were thinking that UNIX is for professionals who know what they're > doing and didn't want to be "molly coddled" and protected from themselves. > That's for Windows users. And, really, this is more an artifact of the > Bourne shell, not the UNIX kernel. In fact, UNIX allows a file to have any > characters in it other than 0x00. Mainly because it is written in C. That's > freedom, which requires responsibility. > > Well, actually, UNIX probably allowed it because it was developed, I > think, on a PDP-7 which was very memory constrained and so they didn't do a > whole lot of coding to validate "reasonableness". > > You might enjoy this: https://web.mit.edu/~simsong/www/ugh.pdf The UNIX > Haters Handbook. > > > >> There may be a legitimate reason why someone would want to create a file >> named -x but if so, then *they* should be made to jump through some small >> hoop and "escape" the name in some way. The innocent victim who stumbles >> into this situation should not be the one made to jump through hoops. Will >> UNIX allow the creation of a file named "rm *"? That could have some >> interesting side effects. >> > > Simple to do that: > > touch 'rm *' > > More "difficult" > > touch rm\ \* > > >> >> How did I inadvertently create a file named -x? I had a pax command >> >> pax -wzvf /my/archive.pax * >> >> I had an error that I thought might be solved by -x os390. Looking at the >> above command I forgot that /my/archive.pax "went with" the -f and coded >> >> pax -wzvf -x os390 /my/archive.pax * >> >> That has the effect of creating an archive named -x. UNIX did not >> complain or warn about that at all. (It complained about some unnamed file >> not being found, presumably os390.) That is poor design IMHO. >> > > Perhaps. But, then again, WAD. Or perhaps BAD. But the command did exactly > what it was documented to do. Might as well complain, as I have, about the > backwardness of COND= in JCL. I now only use // IF and it's friends for > condition checking. > > > >> >> Heck, if the shell is going to expand the * then it could generate a >> warning "hey, did you know that one of your files has a name that looks >> just like a switch?" >> > > Hum, now that might be an interesting thing to be able to do! The BASH > shell has a "shopts" builtin command to set some shell options. The GNU > utilities, well most of them, have a -- options which says anything which > has a leading dash after the double dash is _not_ to be interpreted as an > option. But that is not the shell itself. I think it is really an artifact > of the GNU version of "getopt()" > https://www.gnu.org/software/libc/manual/html_node/Using-Getopt.html > > IBM really goofed up by not using the GNU libraries, or at least their > design, in z/OS UNIX. I am thinking they used base AIX. Which is > hilarious because AIX has GNU ported to it and I am fairly sure every > programmer uses it. > > >> >> Charles >> >> ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN