[Info-vax] Long uptime cut short by Hurricane Sandy

Stephen Hoffman seaohveh at hoffmanlabs.invalid
Thu Jan 31 10:22:58 EST 2013


On 2013-01-31 14:13:55 +0000,   VAXman-  @SendSpamHere.ORG said:

> Show me... without PIPES and myriad other *IX utilities.  Compare only 
> /bin/bash scripting semantics with DCL's.

Um, why?  I've already indicated that the bash shell syntax is cryptic.

I haven't written very many bash scripts without using at least some of 
the Unix utilities, or without using pipes.  I also haven't written 
very many DCL procedures that would meet the same requirements, as most 
common DCL commands are external to the DCL CLI, and I'm finding PIPE 
quite useful in a number of procedures.

If there's a discussion of syntax, I've already granted that bash is 
more cryptic than DCL.  Far more.  Yes, DCL has its share of cryptic 
syntax, too.  This starting with the quoting, and the two-pass 
substitution using apostrophes and ampersand, and particularly when 
mixing quotes and apostrophe and ampersand and PIPE, and when quoting 
substitutions.  Is DCL a paragon of clarity?  No.   But is this DCL as 
cryptic as bash?  No.  Nowhere near.

While the following technically violates the requirements, here's a 
simple bash construct that's very handy:

filename=$filenameprefix"_`date +%Y%m%d%H%M%S`.dmp"

For those unfamiliar with bash, this invokes the date command — one of 
those myriad Unix utilities — in-line and loads a sortable date and 
time directly into the filename specification.

Can you perform the same sequence entirely in DCL using lexical 
functions?  Sure.  Bash and DCL are both Turing Complete, so you can do 
most anything you need[1].  Here's the DCL version of the previous 
example, and this version avoids calling out[2] to external executables:

$ filename = filenameprefix + "_" + f$cvtime(,,"YEAR") + 
f$cvtime(,,"MONTH") + f$cvtime(,,"DAY") + f$cvtime(,,"HOUR") + 
f$cvtime(,,"MINUTE") + f$cvtime(,,"SECOND") + ".dmp"

I've written this DCL many times, as has VAXman, as have many other folks.

BF is Turing Complete, too — caution: NSFW language — 
<http://www.muppetlabs.com/~breadbox/bf/>


————
[1] There's no easy analog for nc/netcat utility or for opening TCP 
connections or UDP sockets within DCL, and a few other specific widgets 
are missing or hairy.  But bash doesn't do much with DECnet.  Whether 
any of that's a problem depends on which network you're working with.

[2] Creating a process or invoking an external utility does have some 
overhead, and there are a few wrinkles in DCL around the effects of the 
image rundown (q.v.: arcane syntax), but that overhead is (usually) 
negligible in recent OpenVMS systems and versions, and is also 
negligible in most any Unix environment.  You have to be doing a whole 
lot of it, for that activity to matter.


-- 
Pure Personal Opinion | HoffmanLabs LLC




More information about the Info-vax mailing list