Im running an rscript from bash script using:
retval=`./rcode.r` 
In rcode print is called many times for debugging purpose. When retval is checked, it has values from all print statements. 
How to return only a single value from a script? Is there any other command to use? What is the right way to return a value from r script to the caller(console/bash)?