How to use Rscript from within a shiny app

It's a little convoluted but I'm using m4 to preprocess markdown files before display in a shiny app. Which works fine ... pipe m4 the file names and then into markdown. All good.

But within the source doc I use esyscmd to call Rscript to do some calculations that m4 can't do. But
it doesn't work. I suspect I need the full pathname to the command /usr/bin/Rscript ... or something.

Any clues about where to look? I can't see the stderr messages that m4 would be producing.

Cheers,
Geoff