Wouldn't it have been easier to submit:
#!/bin/bash
Rscript myscript.RThey may have only been able to submit the single file to the system. (In which case I would have generated the Rscript to a tmpfile, but maybe that wasn't allowed either.)
Re:Writing a Polyglot Script
by rcthompson on Saturday January 25, 2020 @08:01PM
(#22149701)
No, I totally could have written a separate R script that was then run by the bash script. I just wanted to have it all in one file, and I thought it was a fun challenge figuring out how to do it.
Re:Writing a Polyglot Script
by niedzielski on Saturday January 25, 2020 @07:06PM
(#22149469)
I've been collected hacks for a couple languages and tools here: https://git.io/shebang
Re:Writing a Polyglot Script
by rcthompson on Tuesday January 28, 2020 @12:24AM
(#22166689)
I think the difference with mine is that I actually need to squeeze some shell code in there as well, to set up the cluster environment before "handing off" to R/Python.
Here is is, if anyone's interested: https://gist.github.com/DarwinAwardWinner/2eb3705fb6ddab08ee...
And here's the Python version: https://gist.github.com/DarwinAwardWinner/8a631d897d45f00552...