Ask a Question related to PERL Miscellaneous, Design and Development.
-
Himal #1
system command question
I there a reason why a command will not work if i do system "$cmd &>
xyz.log" even though it works if I do system "$cmd"
Himal Guest
-
Displaying part of HTML before and after system() command
Consider my (simplified) code below: With my old ISP it used to display "Archiving database images ..." then paused for a while (30 secs to a few... -
Problem with the Perl System command
Hi, I am facing an issue with the perl system command The relevant lines of code are the following: chdir "$util"; my @args =... -
configuring system DSN from command line Linux
Hello, I have a linux software (runs on mysql) for which i need to configure systemDSN and device driver. I have been configuring SystemDSN... -
what command to view system configuration?
hi all. I forgot command to see al system parameter ... for example: i used it to see firmware release. Bye. -- Massimiliano -
calling system command as another user
Howdy People, I am not a Perl guy and have to make some code work. We have a password reset facility that is Perl cgi based and simply generates... -
J. Gleixner #2
Re: system command question
Himal wrote:
This is an OS/Shell issue.> I there a reason why a command will not work if i do system "$cmd &>
> xyz.log" even though it works if I do system "$cmd"
From your command line try:
whateverCommandYouAreTryingToRun & > xyz.log
and you should see the error.
J. Gleixner Guest
-
Chris Mattern #3
Re: system command question
Himal wrote:
Most likely, the shell perl is using to parse your command is> I there a reason why a command will not work if i do system "$cmd &>
> xyz.log" even though it works if I do system "$cmd"
not csh. Exactly why this is so would depend on your configuration.
Try this, which will work for sh/ksh/bash: system "$cmd >xyz.log 2>&1"
Chris Mattern
Chris Mattern Guest
-
Andreas Kahari #4
Re: system command question
In article <3F61EB8C.8000604@gwu.edu>, Chris Mattern wrote:
There is no reason for it to be csh. The manual for the system> Himal wrote:>>> I there a reason why a command will not work if i do system "$cmd &>
>> xyz.log" even though it works if I do system "$cmd"
> Most likely, the shell perl is using to parse your command is
> not csh. Exactly why this is so would depend on your configuration.
> Try this, which will work for sh/ksh/bash: system "$cmd >xyz.log 2>&1"
command says:
If there is only one scalar argument, the argument is
checked for shell metacharacters, and if there are any, the
entire argument is passed to the system's command shell for
parsing (this is "/bin/sh -c" on Unix platforms, but varies
on other platforms). If there are no shell metacharacters
in the argument, it is split into words and passed directly
to "execvp", which is more efficient.
So it's either /bin/sh (on Unix systems) or no shell at all.,
if you haven't done some pretty freakish changes in the default
configuration.
--
Andreas Kähäri
Andreas Kahari Guest
-
Chris Mattern #5
Re: system command question
Andreas Kahari wrote:
Ah, OK, I thought it used the user's shell. OK, then,> In article <3F61EB8C.8000604@gwu.edu>, Chris Mattern wrote:
>>>>Himal wrote:
>>>>>>>I there a reason why a command will not work if i do system "$cmd &>
>>>xyz.log" even though it works if I do system "$cmd"
>>Most likely, the shell perl is using to parse your command is
>>not csh. Exactly why this is so would depend on your configuration.
>>Try this, which will work for sh/ksh/bash: system "$cmd >xyz.log 2>&1"
>
> There is no reason for it to be csh. The manual for the system
> command says:
>
> If there is only one scalar argument, the argument is
> checked for shell metacharacters, and if there are any, the
> entire argument is passed to the system's command shell for
> parsing (this is "/bin/sh -c" on Unix platforms, but varies
> on other platforms). If there are no shell metacharacters
> in the argument, it is split into words and passed directly
> to "execvp", which is more efficient.
>
> So it's either /bin/sh (on Unix systems) or no shell at all.,
> if you haven't done some pretty freakish changes in the default
> configuration.
>
system "$cmd >xyz.log 2>&1" should be the answer, assuming
the OP is on a Unix system (which seems logical, since he's
trying to use csh syntax).
Chris Mattern
Chris Mattern Guest
-
Anno Siegel #6
Re: system command question
Chris Mattern <syscjm@gwu.edu> wrote in comp.lang.perl.misc:
[...]> Andreas Kahari wrote:> > In article <3F61EB8C.8000604@gwu.edu>, Chris Mattern wrote:
> >> >>Himal wrote:
> >>
> >>>I there a reason why a command will not work if i do system "$cmd &>
> >>>xyz.log" even though it works if I do system "$cmd"
Except that he isn't. "$cmd >& xyz.log" would be csh syntax.> Ah, OK, I thought it used the user's shell. OK, then,
> system "$cmd >xyz.log 2>&1" should be the answer, assuming
> the OP is on a Unix system (which seems logical, since he's
> trying to use csh syntax).
"$cmd &> xyz.log" is neither here nor there.
Anno
Anno Siegel Guest



Reply With Quote

