From: Randal L. Schwartz on
>>>>> "John" == John Kelly <jak(a)isp2dial.com> writes:

John> It's easy to force a shell with some no-op metacharacters:

John> perl -e 'system ":; eval ls /"'

Even simpler, just append ";". Never changes the meaning, and it forces
/bin/sh in the mix.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn(a)stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
From: Ben Morrow on

Quoth merlyn(a)stonehenge.com (Randal L. Schwartz):
> >>>>> "John" == John Kelly <jak(a)isp2dial.com> writes:
>
> John> It's easy to force a shell with some no-op metacharacters:
>
> John> perl -e 'system ":; eval ls /"'
>
> Even simpler, just append ";". Never changes the meaning, and it forces
> /bin/sh in the mix.

Um, what exactly is wrong with

perl -e 'system "/bin/sh", -c => "eval ls /"'

? If you *want* the shell, ask for it.

If you don't know where your shell lives, it's in $Config{sh}.

Ben

From: Randal L. Schwartz on
>>>>> "Ben" == Ben Morrow <ben(a)morrow.me.uk> writes:

Ben> Um, what exactly is wrong with

Ben> perl -e 'system "/bin/sh", -c => "eval ls /"'

1) complexity
2) using => as a bizarro-world comma

Please. Don't. A certain individual started that, and like JAPHs, it's
a meme that deserves to die.

Having said that:

print "Just another Perl hacker,"; # the original

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn(a)stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
From: Ted Zlatanov on
On Mon, 02 Aug 2010 04:32:17 -0700 merlyn(a)stonehenge.com (Randal L. Schwartz) wrote:

RLS> 2) using => as a bizarro-world comma

RLS> Please. Don't. A certain individual started that, and like JAPHs, it's
RLS> a meme that deserves to die.

I find => much better than commas in shell argument lists and many other
places:

1) it quotes the left side--less typing

2) it's much harder to mistype and misread as a period (I've scratched
my head more than once staring at that kind of bug in the source code)

Ted
From: Peter J. Holzer on
On 2010-08-02 11:32, Randal L. Schwartz <merlyn(a)stonehenge.com> wrote:
>>>>>> "Ben" == Ben Morrow <ben(a)morrow.me.uk> writes:
>
>Ben> Um, what exactly is wrong with
>
>Ben> perl -e 'system "/bin/sh", -c => "eval ls /"'
>
> 1) complexity

It looks more complex than

system "eval ls /;"

but it really isn't and that ";" is really easy to miss. So that would
have to be something like

system "eval ls /;"; # ; forces shell

and then you can write

system "/bin/sh", "-c", "eval ls /"

too. It even saves two characters ;-).


> 2) using => as a bizarro-world comma
>
> Please. Don't. A certain individual started that, and like JAPHs, it's
> a meme that deserves to die.

I agree about the "=>".

hp