This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project. See the Cygwin home page for more information.
[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index] [Subject Index] [Author Index] [Thread Index]

RE: bash quoting bug?



Igor, I can reproduce your problem.  

I believe you were tying to indicate that the problem lies in using the
ActiveState binary (regular win32) when calling it from a cygwin bash.  

I don't know much about either ActiveState Perl or Cygnus' bash, and I don't
have a cygwin Perl installed right now but I doubt the problem would occur
there if I did, so perhaps the blame lies with ActiveState.

Since I can't offer a solution, how about a work around?  When you run
command line perl script under NT's CMD shell you need to escape the quote
characters.

Under NT CMD session:
perl -e "printf \"a b\n\";"  

In a UNIX like environment you don't need to:
perl -e 'printf "a b\n";' 

Rather than switch back and forth all the time, I use generic quotes.  This
runs for me under a CMD prompt and a BASH prompt with ActivePerl and under a
Linux bash prompt with a standard Perl build:

perl -e "printf qq/a b\n/;"

Generic quotes let you define the quote character, so you can use any quote
character that does not appear in your string, or matched braces if you
like:

perl -e "printf qq(a b\n);"

Incidentally, I have heard it is "bad" to get in the habit of using printf
in perl where print would suffice, though I don't think it matters very
often ;-)

Ralph Frederick


-----Original Message-----
From: Brian Smith [mailto:Brian.Smith@PicoDyne.com]
Sent: Thursday, February 18, 1999 09:18 AM
To: cygwin@sourceware.cygnus.com
Subject: RE: bash quoting bug?


Interesting,

I'm using BASH on 20.1, and perl version 5.004_04 built for cygwin32,
and the results I got were:
a b


Must be something else,

Brian
-        Brian S. Smith
-     PicoDyne Corporation

> -----Original Message-----
> From: cygwin-owner@sourceware.cygnus.com
> [mailto:cygwin-owner@sourceware.cygnus.com]On Behalf Of Igor Schein
> Sent: Thursday, February 18, 1999 10:28 AM
> To: cygwin@sourceware.cygnus.com
> Subject: bash quoting bug?
> 
> 
> Hi,
> 
> this is with default bash and ActivePerl:
> 
> $ perl -e 'printf "a b\n";'
> Can't find string terminator '"' anywhere before EOF at -e line 1.
> 
> The above works fine with tcsh ( as well as on any other OS I 
> tried it ).  
> So I guess it must be bash bug.
> 
> Thanks
> 
> Igor
> 
> --
> Want to unsubscribe from this list?
> Send a message to cygwin-unsubscribe@sourceware.cygnus.com
> 
> 

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com