SPUG: One-liners on Windows via command.com

William Warner billw at onedrous.org
Wed Mar 23 16:37:03 PST 2005


Actually, I successfully ran the command in a xp cmd shell, using cygwin's 
perl.


On Wed, 23 Mar 2005 byoung at speakeasy.net wrote:

> One word-- cygwin.
>
> I just run all my Perl programs under bash (and/or XEmacs). I've always just accepted that cmd.exe is damaged goods.
>
> Brad
>> -----Original Message-----
>> From: Tim Maher [mailto:tim at consultix-inc.com]
>> Sent: Wednesday, March 23, 2005 06:33 PM
>> To: spug-list at pm.org
>> Subject: SPUG: One-liners on Windows via command.com
>>
>> Can somebody give me pointers on how to modify Unix-ish one-liners
>> to work on Windows systems?
>>
>> For example, this works on UNIX/Linux, because the single quotes (SQs)
>> are recognized as forming a literal string out of their contents,
>> which gets passed as an argument to the command:
>>
>> perl -wle 'print "Crikey";'
>>
>> On Win/XP, the same command elicits this Perl error:
>>
>> C:\ perl -wle 'print "Crikey";'
>> Can't find string terminator "'" anywhere before EOF at -e line 1.
>>
>> I had expected some indication that command.com wouldn't know what
>> to do with the SQ, as opposed to an indication that Perl only got
>> a single one in -e's argument!  Can somebody explain what SQs do in
>> this shell?
>>
>> On the other hand, I find that DQs as exterior quotes work fine
>> (on XP), and the backslash even appears to quote nested DQs, as
>> it does in the Unix shells:
>>
>> C:\ perl -wle "print \"Crikey\";"
>>
>> and qq operator works:
>>
>> C:\ perl -wle "print qq{Crikey};"
>>
>> as does the arguably more appropriate q operator:
>>
>> C:\ perl -wle "print q{Crikey};"
>>
>> or the SQ itself:
>>
>> C:\ perl -wle "print 'Crikey';"
>>
>> So now I'm wondering, do DQs in this shell allow any interpolations?
>> If so, what Perl symbols would need to be quoted to suppress that?
>> Where does one get documentation on the workings of this shell?
>>
>> "man perlport" provides lots of info on modifying Perl programs
>> /themselves/ for portability, but it has virtually nothing to say
>> on the subject of passing Perl code as a command-line argument.
>>
>> Can somebody point me to their favorite tutorial covering the use
>> of command-line Perl techniques with Win32 systems?
>>
>> TIA,
>> -Tim
>> *--------------------------------------------------------------------------*
>> | Tim Maher, PhD     (206) 781-UNIX      (866) DOC-PERL     (866) DOC-UNIX |
>> | tim(AT)Consultix-Inc.Com  http://TeachMePerl.Com  http://TeachMeUnix.Com |
>> *+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-*
>> |    Watch for my June, 2005 book: "Minimal Perl for UNIX/Linux People"    |
>> *--------------------------------------------------------------------------*
>> _____________________________________________________________
>> Seattle Perl Users Group Mailing List
>>      POST TO: spug-list at pm.org
>> SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list
>>     MEETINGS: 3rd Tuesdays, Location: Amazon.com Pac-Med
>>     WEB PAGE: http://seattleperl.org/
>>
>
>
> _____________________________________________________________
> Seattle Perl Users Group Mailing List
>     POST TO: spug-list at pm.org
> SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list
>    MEETINGS: 3rd Tuesdays, Location: Amazon.com Pac-Med
>    WEB PAGE: http://seattleperl.org/
>


More information about the spug-list mailing list