[R] strange behavior of system command

Steve Lianoglou mailinglist.honeypot at gmail.com
Wed Jul 22 20:28:12 CEST 2009


Hi Erin,

On Jul 22, 2009, at 2:16 PM, Erin Hodgess wrote:

> Dear R People:
>
> I'm running from R to a grid computer and getting some unusual results
> with the system command:
>
>> e7 <- system("globus-job-run xxxxx /bin/sh -c 'cd $OSG_APP/ 
>> engage;chmod 777 oops'",intern=TRUE)
> chmod: changing permissions of `oops': Operation not permitted
>> e7
> character(0)
>>
>
>
> I xx'ed out the site name.  Anyhow, I would expect that the e7 would
> contain the warning.  Is there any way to have e7 contain the warning
> please?


You'll see this call in the "Stdout and stderr" section of ?system:

system("some command 2>&1", intern=TRUE)

The "2>&1" is a command that redirects stderr to stdout, and it seems  
that intern=TRUE only captures sdout, so in your case, are you running  
to commands at once? I don't know, the command looks weird to me, but  
I think the help is suggesting to:

e7 <- system("globus-job-run xxxxx /bin/sh -c 'cd $OSG_APP/ 
engage;chmod 777 oops' 2>&1",intern=TRUE)

??maybe?? or do you have to add the 2>&1 to each of the separate  
commands you're invoking? Play around with that and see.

-steve

--
Steve Lianoglou
Graduate Student: Physiology, Biophysics and Systems Biology
Weill Medical College of Cornell University

Contact Info: http://cbio.mskcc.org/~lianos/contact




More information about the R-help mailing list