Jon Nelson on 19 Nov 2007 19:09:31 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Perl backticks/system question


On Mon, 2007-11-19 at 13:59 -0500, Walt Mankowski wrote:
> On Mon, Nov 19, 2007 at 01:37:26PM -0500, Jon Nelson wrote:
> > On Mon, 2007-11-19 at 13:03 -0500, Walt Mankowski wrote:
> > > On Mon, Nov 19, 2007 at 12:41:52PM -0500, lists@linuxnotes.net wrote:
> > > >     root@2[cgi-bin]# perl -MConfig -le 'print $Config{sh}'
> > > >     /bin/sh
> > > >     root@2[cgi-bin]#
> > > >     root@2[cgi-bin]# ls -al `which sh`
> > > >     lrwxrwxrwx 1 root root 4 Jul  6 12:59 /bin/sh -> bash
> > > > 
> > > > So it looks like I am using the same shell, but still getting the errors.
> > > 
> > > (Lots of stuff snipped since it was becoming unreadable anyway.)
> > > 
> > > It's clear that perl is using bash.  But you said that you could enter
> > > commands with parens from the command line and not get any errors,
> > > which implies that maybe your own shell is something other than bash.
> > > 
> > > Here's what happens when I try to use parens from bash:
> > > 
> > > $ echo a(b)c
> > > bash: syntax error near unexpected token `('
> > > $ echo a\(b\)c
> > > a(b)c
> > > 
> > > Are you sure your shell is bash?  What do you see when you enter
> > > 
> > > $ echo $SHELL
> > 
> > /bin/bash
> > 
> > I must not have been too clear when I was trying to explain myself
> > before, but I will try again.
> > 
> > When I run the perl script (which in turn runs the bash script) I get
> > the syntax error.  If I manually run the bash script and provide it with
> > the arguments, in the same format that quotemeta does, I get no errors.
> 
> No, that's how I understood the problem.  Do you also get a syntax
> error when you run
> 
> $ echo a(b)c
> 
> Anyway, I'm out of guesses.
> 

Yep I get the error.

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug