H
Himal
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"
xyz.log" even though it works if I do system "$cmd"
Himal said: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 said: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"
Andreas said: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.
Chris Mattern said:[...]
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).
Except that he isn't. "$cmd >& xyz.log" would be csh syntax.
"$cmd &> xyz.log" is neither here nor there.
Except that he isn't. "$cmd >& xyz.log" would be csh syntax.
"$cmd &> xyz.log" is neither here nor there.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.