Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: system() call mis-directs?

by Clarkman (Novice)
on Mar 03, 2020 at 01:05 UTC ( #11113681=note: print w/replies, xml ) Need Help??


in reply to Re: system() call mis-directs?
in thread system() call mis-directs?

Thank you both!

@sundialsvc4, thank you but logs have been checked and re-checked.

@jcb, you may have nailed it.

$sensors looks like this: ABC-00-DEF-1234 --sitename=Charon .

The double hyphen is suspicious as is the '='

Will test out tomorrow and post results. Thank you !

Replies are listed 'Best First'.
Re^3: system() call mis-directs?
by jcb (Priest) on Mar 03, 2020 at 02:42 UTC

    Your sample does not contain any troublesome characters, but the shell splits on unquoted whitespace, which my earlier suggestion would prevent by wrapping $sensor in shell quotes before passing it to the shell. My immediate suspicion is that you may have some "odd" site names. In particular, an ampersand is both reasonable in human-readable names and special to the shell.

    The best way to fix this would be to get the shell out of the picture and use the list form of system. You will also need to use open or sysopen to rearrange your filehandles so that the second child will inherit STDOUT and STDERR opened for append on the worklog file, while the first child keeps its original STDOUT somewhere to report the result from the second child.

A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11113681]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (2)
As of 2020-07-16 03:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?