I got these two lines that I want to run from a script file (on Yosemite 10.10.3). It works when running from terminal
CX_LICENSE=LS
open -n /Applications/Inspire\ Designer\ 10.0\ GA/Inspire\ Designer.app/
I saved these two lines in a file and named it run ID. -rwxr-xr-x@ 1 Administrator staff 89 20 Jul 17:34 runID
If I double click runID then I get new window with
Last login: Mon Jul 20 17:22:27 on ttys002
dsa-mac1:~ Administrator$ /Users/Administrator/Desktop/runID ; exit;
: command not foundr/Desktop/runID: line 1:
/Users/Administrator/Desktop/runID: line 1: -n: command not found
logout
[Process completed]
any idea how to make runID work?
Best Answer
You're missing the initial line of your script file - the "shebang".
Put the following in your script file:
That should work - the file you had before did not have enough information to tell the operating system how to run your script. You want to run a set of shell commands, so you need to tell the operating system it's a shell script, which is done by including the
#!/bin/sh
as the first line of the script.See this answer on Stack Overflow for more information.
Update
Just to confirm, I've just tested this script and it works fine:
As correctly pointed out by @fd0, you should name the script
<script>.tool
or<script>.command
for it to be executed from Finder (where<script>
is a meaningful name for the script).