[Info-vax] Unix and DCL shells

mjos_examine m6502x64 at gmail.com
Mon Jan 8 16:41:57 EST 2024


On 2024-01-08 3:35 p.m., Arne Vajhøj wrote:
> On 1/8/2024 3:19 PM, Scott Dorsey wrote:
>> Simon Clubley  <clubley at remove_me.eisner.decus.org-Earth.UFP> wrote:
>>>
>>> It also has much more powerful pattern matching than DCL offers, which
>>> is why I would like to see it on VMS.
>>
>> regexps are built into a lot of Unix utilities at fairly low levels and
>> this is incredibly powerful.
>>
>> But I cannot say "mv *.txt *.dat" in order to change every file extension
>> in the current working directory.  This is the downside.
> 
> But DCL is not bash.
> 
> I actually think it could work in DCL.
> 
> $ SET PROC/GLOB=ON
> $ REN *.TXT "*.DAT"
> 
> could be interpreted as:
> 
> $ REN 1.TXT,2.TXT,3.TXT *.DAT


In the "spitballing" department, and wanting solutions that don't "break 
too much", are the two things outlined below possible today?

     $ VMSGLOB -command "[a-c]*" -symbol foo
     $! my_ported_unix_program expects globbing to be done already
     $ my_ported_unix_program 'foo'

VMSGLOB could carry out glob-style filename expansion in the same manner 
as globbing does on UNIX, and store the result (via -symbol arg) in the 
symbol specified, possibly with each resulting file name enclosed in 
quotations ( if -quoted arg included maybe?).

If you wanted to use the glob results in DCL:

     $ VMSGLOB -command "[a-c]*" -symbol foo -delim "|"
     $ NUM = 0
     $ LOOP:
     $       MYFILE = F$ELEMENT(NUM,"|", foo)
     $       IF MYFILE .EQS. "|" THEN GOTO DONELOOP
     $       DIRECTORY 'MYFILE'
     $       NUM = NUM +1
     $       GOTO LOOP
     $ DONELOOP:

I think that might already be possible today, if you had the VMSGLOB 
foreign command to look after the -command arg, -symbol arg, -delim arg, 
-quoted.

On a similar note, since DCL already respects the DECK and EOD commands, 
example:
     $ CREATE FILE.LIS
     $ DECK
     File data
     File data
     $ EOD
there could be a VMSBASH foreign command, where you could utilize the 
DECK command, like so:
     $ VMSBASH
     $ DECK
     if ! test -f /path/to/file; then
     echo "File does not exist."
     fi
     $ EOD

You could (in theory) place any arbitrary bash script, for 
interpretation and execution by a VMSBASH foreign command that expects 
to operate in that way, between $DECK and $EOD.

The command preceding the DECK command could function somewhat like the 
niche of #!/bin/bash on UNIX for specifying the desired interpreter for 
the arbitrary syntax that is between $DECK and $EOD.





More information about the Info-vax mailing list