"Martin Vorlaender" <[EMAIL PROTECTED]> wrote:

> You prefix the perl script with

> $ perl 'f$env("procedure")' "''p1'" "''p2'" "''p3'" "''p4'" "''p5'"
"''p6'"
> "''p7'" "''p8'"!
> $ exit++ + ++$status!=0 and $exit=$status=undef; while($#ARGV != -1 and
> $ARGV[$#ARGV] eq ''){pop @ARGV;}
>     eval 'exec  -S $0 ${1+"$@"}'
>        if $running_under_some_shell;

Slight simplification:

The following three-liner (well, four counting the __END__) reads a perl
script from STDIN, wraps it in a DCL command procedure, and writes the
output to STDOUT.

use Config;
print "$Config{startperl}\n";
while (<>) {print;}
__END__

This perl script and the definition of DCL$PATH can go quite a way toward
"civilizing" things for you.

There _is_ one thing that you need to be warned about, if you're coming
into VMS from Unix.

VMS commands are _not_ case-sensitive. DCL (the VMS shell) takes care of
this by converting everything to uppercase unless it's quoted. The "C"
runtime then converts all unquoted arguments to lowercase. Also, you get
quotes inside quotes not by escaping them but by doubling them. So the
VMS-native equivalent to the Bash

$ echo He said, \"Don\'t shoot\!\"
He said, "Don't shoot!"
$

is

$ write sys$output "He said, ""Don't shoot!"""
He said, "Don't shoot!"
$

The Perl script echo.pl:
#!/usr/bin/perl
print "@ARGV\n";
__END__

needs to be invoked the same way:

$ perl echo.pl "He said, ""Don't shoot!"""

But if you convert this to a .COM file, you expand quoted strings twice, so
any quotes that need to appear in the output must be doubled twice. So
assuming DCL$PATH is defined, the echo.com needs

$ echo "He said, """"Don't shoot!"""""

to get the same effect.

This discussion completely ignores the fact that 'foo' specifies the
substitution of DCL symbol foo in much the same way that ${foo} would
substitute environment variable foo. Except that inside quotes (meaning ""
characters) you need to double the leading apostrophe ONLY (e.g. "''foo'").

But it goes both ways. I hate to say how long it took me to figure out what
needed to be escaped in the Bash example.

Tom



This communication is for use by the intended recipient and contains 
information that may be privileged, confidential or copyrighted under
applicable law.  If you are not the intended recipient, you are hereby
formally notified that any use, copying or distribution of this e-mail,
in whole or in part, is strictly prohibited.  Please notify the sender
by return e-mail and delete this e-mail from your system.  Unless
explicitly and conspicuously designated as "E-Contract Intended",
this e-mail does not constitute a contract offer, a contract amendment,
or an acceptance of a contract offer.  This e-mail does not constitute
a consent to the use of sender's contact information for direct marketing
purposes or for transfers of data to third parties.

 Francais Deutsch Italiano  Espanol  Portugues  Japanese  Chinese  Korean

            http://www.DuPont.com/corp/email_disclaimer.html


Reply via email to