Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][tlug] Sticky problem with pipes, head and tails
- Date: Tue, 31 Aug 2010 18:21:23 -0500
- From: Stuart Luppescu <slu@example.com>
- Subject: [tlug] Sticky problem with pipes, head and tails
Hello, As you can see from my signature in this message (yes, I know it's longer than 4 lines), I use the R fortune function to generate a fortune, which is then fed to the signature program, which constructs a named pipe containing the fortune-bearing sig, which is then included in mail messages. The problem is that it's got extraneous junk in it and I can't figure out how to get rid of it. This is the command that generates the fortune: /usr/bin/R --no-save --no-restore -q < /home/sl70/print-fortune.R This produces this: > library(fortunes) > fortune() Michael Watson: Hopefully this one isn't in the manual or I am about to get shot :-S Peter Dalgaard: *Kapow*... -- Michael Watson and Peter Dalgaard (question on axis()) R-help (February 2006) > I would like to remove the first two lines and the last line, so I changed the command to this: /usr/bin/R --no-save --no-restore < /home/sl70/print-fortune.R |tail \ -n +23 | head -n -2 2> /dev/null That give the desired result when I run it at the command line, but when I feed it to the signature program, I get this message: Program /usr/local/bin/r-fortune doesn't seem to exist This is the program code that produces this error: /* check for existence of program by forking and then trying to exec() it in the child */ pid = fork(); switch (pid) { case -1: /* oh well */ perror("Couldn't fork() a child process"); exit(EXIT_FAILURE); case 0: /* in child */ /* close stdout */ close(1); execlp(producer, producer, (char *) 0); exit(EXIT_FAILURE); default: waitpid(pid, &exit_status, 0); if (exit_status != EXIT_SUCCESS) { fprintf(stderr, "Program %s doesn't seem to exist\n", producer); exit(EXIT_FAILURE); } Unfortunately, I don't understand this at all. Can anyone give me a clue as to what's happening? Thanks. -- Stuart Luppescu -=- slu .at. ccsr.uchicago.edu University of Chicago -=- CCSR 才文と智奈美の父 -=- Kernel 2.6.34-gentoo-r1 > library(fortunes) > fortune() Maybe you should contact Microsoft, and get them to modify their tools so they work on the R sources? -- Duncan Murdoch (answering the question if there is a way compiling the R sources using VisualC++) R-help (April 2004) >Attachment: smime.p7s
Description: S/MIME cryptographic signature
- Follow-Ups:
- Re: [tlug] Sticky problem with pipes, head and tails
- From: Kalin KOZHUHAROV
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] Network performance
- Next by Date: Re: [tlug] Sticky problem with pipes, head and tails
- Previous by thread: Re: [tlug] Further adventures in stability and security: backups
- Next by thread: Re: [tlug] Sticky problem with pipes, head and tails
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links