The following works fine on Mac OS X:

```
#!/bin/bash
R CMD Sweave myfile.Rnw
pdflatex myfile.tex
open myfile.pdf

```

Now, I realize that these 3 lines of code are really helpful for my work – independently of some particular file. Thus I'd like to use the file as an argument. I know how to use an argument itself but have problems splitting the input after the string and concat it afterwards. If I was able to split the filename argument like: 

```
split($1,".") # return some array or list ("name","ext")

```

Or is there a simpler, completely different way than using Python within a shell script?

Thx in advance for any general advice and examples as well !