[R] multiline system call
Charles C. Berry
cberry at tajo.ucsd.edu
Fri Dec 22 20:05:27 CET 2006
Look at the help page for ?system, especially the 'input=' arg.
Maybe this sort of strategy will fly:
> system("sh",intern=T,input=c("echo x","echo y"))
[1] "x" "y"
>
In your case, maybe
system('sh' input=c('sendmail -f xxx at swing.be -t yyy at swing.be','test','.')
or
system('sendmail -f xxx at swing.be -t yyy at swing.be', input='test')
will do it.
On Fri, 22 Dec 2006, Nicolas Mazziotta wrote:
> Hello,
>
> I am trying to call sendmail from within R via system(). As sendmail reads
> from STDIN, I need to pass a multiline input as an argument.
>
> E.g. (not working):
>
> system('sendmail -f xxx at swing.be -t yyy at swing.be\ntest\n.\n')
>
> I tried a lot of ways to type the EOL characters, but cannot get them work the
> right way. This leads to several problems. For instance, R waits for me to
> enter <control-D> at the end of the sequence.
>
> Thanks for any help.
>
>
>
> --
> Nicolas Mazziotta
>
> The contents of this e-mail, including any attachments, are ...{{dropped}}
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
Charles C. Berry (858) 534-2098
Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu UC San Diego
http://biostat.ucsd.edu/~cberry/ La Jolla, San Diego 92093-0717
More information about the R-help
mailing list