[Info-vax] Long uptime cut short by Hurricane Sandy
David Froble
davef at tsoft-inc.com
Thu Jan 31 17:11:33 EST 2013
Stephen Hoffman wrote:
> 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.
Yes, I have, and my comment is that when I'm reading the above, I easily
get the idea that f$cvtime is doing something with dates, and "MONTH",
"DAY" and such gives me an idea without thinking about the details of
what's being worked with.
Now in the bash example, I have to admit that "date" is a bit of an
indicator, and with some thinking I should realize what "Y", "m", "d",
"H", "M", and "S" might be referring to, I don't have a clue why some
are uppercase and some lowercase, or if it matters.
I've always felt that any code written should be easy to maintain, and
DCL being a bit more verbose and "english" provides a lot of that.
And yeah, it can entail more typing ...
More information about the Info-vax
mailing list