in reply to Re^4: Perl & R ?
in thread Perl & R ?

how about...
system "R --no-save < commands.R 2>&1 > /dev/null";

Replies are listed 'Best First'.
Re^6: Perl & R ?
by Jaya (Acolyte) on Mar 29, 2005 at 08:19 UTC
    thank you. this does work!

    what does /dev/null stand for?

    what does 2 and &1 stand for

    how to interpret this command

    I am new to perl. I am sorry if these questions sound trivial

      This is not Perl, this is shell. When you call the system function, you pass a string that is executed by a shell (usually /bin/sh) just like you called
      /bin/sh -c your-command-here
      /dev/null is a special device that acts like a well for your data - it silently eats them and throws them into nowhere. Useful for problems, ain't it? :)

      2>&1 redirects standard error (file descriptor 2, where error messages usually are written) to standard output (file descriptor 1, where normal messages are usually printed). I don't know what the Anonymous Monk wanted to do, but I bet that he should change the order of redirections:

      ... >/dev/null 2>&1
      Otherwise, you'll have errors on the standard output, and the normal standard output thrown away (while I think that he inteded to throw away both of them).

      You can learn a bunch of things about the shell viewing the bash man page, anyway.

      Flavio

      Don't fool yourself.