Call R function in Linux command line
A simple built-in is the following BASH commands:
export NUM=10R -q -e "rnorm($NUM)"
Yes, there is -- littler was written for exactly that purpose.
R itself added Rscript shortly thereafter, but as one of the two dudes behind littler I still like it better.
If your program is going to work on a single dataset, then simple-r might be the solution:
http://code.google.com/p/simple-r/
It is especially designed for simple statistical analysis as a part of Linux command line.