I have an Rscript that I run using crontab, that take a long time to complete. I'm appending the output of it to a file, and have littered the code with print
statements to track the progress of the script as it's running in the background.
This works, but I'm getting tired of adding more and more print
statements. What I really want is to see what command it's running together with the output it generates. E.g. when running the following script:
$ cat test.r
#!/bin/env Rscript
Sys.sleep(10)
3+2
I'd like the output to somehow be
> Sys.sleep(10)
> 3+2
[1] 5
i.e. exactly what I'd see had I run it interactively.
Any ideas?