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}}
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
Dear Sir, Le vendredi 22 d?cembre 2006 20:05, vous avez ?crit :> system("sh",intern=T,input=c("echo x","echo y"))Thanks for the advice, but I do not find doc about the input arg for the system function. Besides, $> system("sh",intern=T,input=c("echo x","echo y")) Erreur dans system("sh", intern = T, input = c("echo x", "echo y")) : unused argument(s) (input = c("echo x", "echo y")) Is R version 2.4.0 (2006-10-03) too old? Best regards, -- Nicolas Mazziotta The contents of this e-mail, including any attachments, are ...{{dropped}}
Its only available on Windows. On 12/22/06, Nicolas Mazziotta <nicolas.mazziotta at swing.be> wrote:> Dear Sir, > > Le vendredi 22 d?cembre 2006 20:05, vous avez ?crit : > > system("sh",intern=T,input=c("echo x","echo y")) > > Thanks for the advice, but I do not find doc about the input arg for the > system function. Besides, > > $> system("sh",intern=T,input=c("echo x","echo y")) > Erreur dans system("sh", intern = T, input = c("echo x", "echo y")) : > unused argument(s) (input = c("echo x", "echo y")) > > Is R version 2.4.0 (2006-10-03) too old? > > Best regards, > > > -- > 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. >
Maybe Matching Threads
- vcd package, assoc()
- Dict proxy client returning empty string instead of multiline string
- Dict proxy client returning empty string instead of multiline string
- Dict proxy client returning empty string instead of multiline string
- Dict proxy client returning empty string instead of multiline string