[Info-vax] Unix and DCL shells
Lawrence D'Oliveiro
ldo at nz.invalid
Wed Jan 10 18:23:35 EST 2024
On Mon, 8 Jan 2024 14:21:18 -0000 (UTC), Simon Clubley wrote:
> Filename globbing.
Coming back to this, it’s worth pointing out that you cannot simply add
features, willy-nilly, to a framework that was not designed with them in
mind.
Consider how the whole VMS mindset expects the command-line to work: there
is a distinction between filespecs separated by spaces and those separated
by commas, and even plus-signs. The CLI never does wildcard expansion, and
on the one hand this puts the burden on the program (which has the
powerful RMS $PARSE service to call on) to expand input filespecs, and on
the other hand it allows wildcards to appear in output filespecs as well
(again, supported by $PARSE) to indicate “use the same value here as in
the input filespec”.
That latter meaning is something I have sometimes missed on *nix systems.
In the *nix world, there is actually no requirement for filename globbing
to happen in a command at all. Shells usually do it, and they usually
provide a way to tell them not to do it. (If only because, believe it or
not, those globbing wildcard characters are valid in filenames, too.) If
one user program is directly spawning another, without going through a
shell, then it has to explicitly call some library routine to do globbing,
otherwise it doesn’t happen.
There is no equivalent to CLD files in the *nix world. (In my time on VMS,
I found them too fiddly to use, anyway, and relied on a simple “foreign”
command using LIB$TPARSE instead.) But one thing that improves the
situation is that the “command line” is not a simple string, but an array
of strings. And by default the shell will do word-splitting on the command
line the user passes, to build this array. So it is possible to implement
very simple option parsing in any program, without resorting to very
elaborate libraries, to support a useful range of command-line options.
More information about the Info-vax
mailing list