[EMAIL PROTECTED] wrote:

> platform is Unix - Korn shell.  I need to escape a number of characters;
> which works fine, except for double backslashes (\\).  I cannot get the
> script to properly escape these.  Here's the code for my script. (I've
> tried using both straight backslashes as well as setting a string of
> backslashes to the $dbs variable - neither with success.) I'd be much
> appreciated of any seasoned veteran who could provide a tip!

I'm not sure what you're trying to do with double backslashes.
This script, though, escapes any of '"/*()&| with a preceding backslash.
It also escapes $AUTO (I don't know why).

while (<>)
{
        my $in_string = $_;
        $in_string =~ s{([\\/*()&|"'])}{\\$1}g;
        $in_string =~ s{\$AUTO}{\\\$AUTO}g;  #escape $AUTO, for output files
        print $in_string;
}

Run it and see if the quoting is what you want.

Your code had a couple of problems with quoting:

First, every time you interpolate a string into a double quoted string,
its
backslashes will be stripped off or otherwise interpreted (for instance,
"\n"
becomes a newline).

So don't do that (see my print above, which doesn't interpolate the
variable).

Second, when you pass a string to the shell, it's going to interpolate
as well,
depending on quoting.

-- 
Ned Konz
currently: Stanwood, WA
email:     [EMAIL PROTECTED]
homepage:  http://www.bike-nomad.com

---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
         [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
         [EMAIL PROTECTED]

Reply via email to