See the previous reply, but also if you want to run a shell script and
need to pass arguments like file names or dir names or anything else,
you cane you the following (${1} -- 1st argument to the shell script,
${2} -- second etc):
#!/bin/sh
echo 'a="${1}";b="${2}"; source("codeWith_a_and_b.R")" | R --vanilla --quiet
The from shell (e.g. to process smth in this dir, a, with b=2):
./thisScript `pwd` 2
Oleg
--
Dr Oleg Sklyar | EBI-EMBL, Cambridge CB10 1SD, UK | +44-1223-494466
Amir Herman wrote:
> How can I run something like source("filename") from the Unix command line?
> Maybe somthing like ./R CMD source("filename") - this does not work.
>
> I need to run an R source code file with a command from the Unix command
> line.
> assuming that I have R installed on my system.
>
> Thank you all
> Amir.
>
______________________________________________
[email protected] 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.