0

I'm trying to write a simple double-clickable file.command on my Mac OSX machine. Here is my shell script on the .command file:

 #!/usr/bin/env Rscript
 Rscript /Users/MyName/Dropbox/Workout_log_script/workout_log.R

And here is the error I get:

 MyName$ /Users/MyName/Desktop/workout_plotter.command ; exit;
 Error: object 'Rscript' not found
 Execution halted
 logout

I don't have much experience with using bash. Does anyone know how I can fix this? Thanks!

2 Answers 2

2

You are mixing two possible ways to do it:

either write a Bash script that launches the Rscript utility:

#!/bin/bash
Rscript /Users/MyName/Dropbox/Workout_log_script/workout_log.R

making sure Rscript is available from the $PATH and the Bash script is executable ; or

make the R script executable and add the so-called shebang

#!/usr/bin/env Rscript

at the first line of the R script. The R script will then be runnable by double clicking it.

Sign up to request clarification or add additional context in comments.

Comments

1

your interpreter string is not ok for bash use /usr/bin/Rscript

and make your script executable whit chmod 755 <script>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.