[R] get the command line

Peng Yu pengyu.ut at gmail.com
Mon Sep 7 06:00:09 CEST 2009


On Sun, Sep 6, 2009 at 10:50 PM, Steve
Lianoglou<mailinglist.honeypot at gmail.com> wrote:
> Hi,
>
> On Sun, Sep 6, 2009 at 11:25 PM, Peng Yu<pengyu.ut at gmail.com> wrote:
>> Hi,
>>
>> commandArgs gives me the arguments. I am wondering what command can
>> give the whole command line.
>
> What does "the whole command line" mean? Are you looking for the
> command args in one string?
>
> paste(commandArgs(), collapse=" ")
>
> Can you give an example of what you're trying to get?

For example, I run the following command in bash.

Rscript some_script.R a b c

I want to get the string "Rscript some_script.R a b c" in the script
some_script.R.

Regards,
Peng




More information about the R-help mailing list