I have the following script 

```
 #!/bin/bash
 /usr/bin/osascript << EOT
 set myfile to choose file
 EOT

 no_ext=$(python -c "print '$myfile'.split('.')[0]")

 ### this works - just need to know how to pass the arg
 R CMD Sweave no_ext.Rnw
 pdflatex no_ext.tex
 open no_ext.pdf

```

Can anyone point me to "how to pass the variable myfile correctly" ?

EDIT
Thx for all the suggestions!

Don't know what to accept, all of your answers really helped me since I learned a lot from everybody.