Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!samsung!spool.mu.edu!uunet!cos!fetter From: fetter@cos.com (Bob Fetter) Newsgroups: comp.os.misc Subject: Re: Globbing Message-ID: <44381@cos.com> Date: 26 Mar 91 03:52:27 GMT References: Reply-To: fetter@cos.UUCP (Bob Fetter) Organization: Corporation for Open Systems, McLean, VA Lines: 82 In article peter@ficc.ferranti.com (Peter da Silva) writes: >As an excersize I am in the process of writing a shell for UNIX that only >performs globbing when requested. It is not going to be anything of the >complexity of the regular UNIX shells... sort of a baby shell for novices. >So far the total length of the shell is 472 lines, and it already parses >statements and executes them. No globbing is as yet implemented. > >+ echo 'The only quoting character is single quotes' >The only quoting character is single quotes >+ echo 'Unclosed quotes are automatically and silently closed >Unclosed quotes are automatically and silently closed >+ echo 'You continue a line\ >- by escaping it with a backslash' >You continue a line >by escaping it with a backslash >+ echo 'You quote a quote by doubling it''' >You quote a quote by doubling it' > And... >+ echo 'I''m planning on doing globbing like so: [*.c]' >I'm planning on doing globbing like so: split.c getline.c bsh.c domagic.c > >Any suggestions? I was thinking of continuing lines if there were unclosed >quotes, but that has proven a source of confusion on UNIX with the bourne >shell. > And, of course, any interest? Clean and simple. To continue in this model, might I suggest that you use the [ ... ] to enclose *any* command, the results of which are replaced in the command line (a-la ` ... ` in other shells). This would then have one employ the old glob(1) command to expand wildcards. And, as far as (human) simplicity goes, well, many folks have the impression that all of the characters ' (single quote), " (double quote) and ` (grave) *all* are "quoting characters". Why not allow them all, with the only rule being that they are paired? BTW--with the [..] change and extending quotation characters to all three, it would be effectively a remake of the Multics command_processor_ parser logic. So, quoting a quote, say, would be: " '"' ' "'" ` '`' or other combinations. You might consider, if you haven't already, constructs like: my_command argument1" with more" argument2 "argument "three argv[] "argument1 with more" "argument2" "argument three" Forms like this I've used on other shells (Multics, some Honeywell minis, IBM, etc.), and is really (to me) intuitive and usefull in scripts with argument/parameter substitution, etc. BTW - this parsing, with the slight (?) changes/suggestions above, effectively duplicate the Multics command_processor_ parsing logic (Minus the command iteration construct using parenthesis). Um, with the small size and all, does that include support for multiple commands and piping? If so, it sounds like tight code! Yeah, I'm interested in this... it might make an interesting net-project to find out what a collective effort/discourse would result in. Maybe, after all the flames and retoric about "simple is best", maybe this would result in a minimalist shell with intellegent per-user extension capabilities (something I've mulled on lately, with dynamic linking finally becoming more pervasive). Just my $.02 here. -Bob-