Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • It's good to run do shell script "set" just by itself to see what's available by default when shelling out. Commented Apr 26, 2020 at 20:17
  • Thank you, that works. My confusion was caused by the fact that I see things like do shell script "/bin/tcsh my-command-file-path" (from an Apple doc), which made me think that it works the same for direct commands. Isn't the shell specifier redundant to begin with if you use a shebang in the external script file? Commented Apr 26, 2020 at 21:43
  • It will ignore the shebang because it will attempt to execute the script using /bin/sh instead of treating the script like an executable. If you want to run only a bash script (not a command) you can just use do shell script "/usr/local/bin/bash /full/path/to/script.bash" Commented Apr 26, 2020 at 21:53
  • Alright. But if my script is already an executable (which it needs to be) with the shebang I can just do something like do shell script "~/Library/Scripts/Script.sh" right? I'll probably go for that option. Commented Apr 26, 2020 at 21:56
  • 1
    Yeah, odd. You're sure your script is executable? I've set it to chmod u+x. Commented Apr 28, 2020 at 11:01