scsh-users
[Top] [All Lists]

globbing and shell syntax

To: scsh@martigny.ai.mit.edu
Subject: globbing and shell syntax
From: Olin Shivers <shivers@lambda.ai.mit.edu>
Date: 18 Apr 1997 20:38:04 -0400
Organization: Artificial Intelligence Lab, MIT
    From: alaric@abwillms.demon.co.uk (Alaric B. Williams)
    Subject: Re: Shell syntax and Scheme (Reply to Chris Bitmead)

    But how about (glob <filespec>), which returns a list of string
    filenames...

    (cat "alaric.txt")

    (cat . (glob "*.txt"))

    Saves all that messiness of escape codes and so on!

Well, that's a good idea, Alaric, for *programs* -- it's a very powerful
feature to be able to use any procedure or general Scheme expression you like
to make up an argument list. But it's a little cumbersome for an interactive
command language. Which would you rather write:

    (run (mv ,@(glob "*.txt") /tmp))
or
    mv *.txt /tmp

Merely stripping off the outer layer of parens from the first choice doesn't
really reduce the pain much:
    
    run (mv ,@(glob "*.txt") /tmp)

If you are interested in these sorts of issues, you might enjoy reading
one or two documents I wrote about this kind of thing:

    ftp://www-swiss.ai.mit.edu/pub/su/scsh/scsh-paper.ps
    ftp://www-swiss.ai.mit.edu/pub/su/scsh/scsh-manual.ps
    http://www.ai.mit.edu/~shivers/ll.ps

As you have noticed, it is certainly a fun design problem to think about.
    -Olin

<Prev in Thread] Current Thread [Next in Thread>