On Mac OS X, the following works fine:
#!/bin/bash
R CMD Sweave myfile.Rnw
pdflatex myfile.tex
open myfile.pdf
Now I understand that these 3 lines of code are really useful for my work - regardless of the specific file. So, I would like to use the file as an argument. I know how to use the argument itself, but it has problems with breaking the input after the string and then concatenating it. If I could break the file name argument, for example:
split($1,".") # return some array or list ("name","ext")
Or is there a simpler, completely different way than using Python in a shell script?
Thanks in advance for any general tips and examples!
source
share