Is it possible to determine - from within the script - whether the script is running in the R-GUI (specifically R.app on OS X) or whether it has been called from Terminal/co
In C, you would use the isatty function. If you could find an equivalent function in R (probably in a UNIX or file system library), that should help.
C
R
Perhaps you are looking for interactive()?
interactive()