television

Television Station GTV9 Melbourne Australia

A collection of images, stories and memories.

Home 1956_1969 1970_1979 Reunions Stories Contact

Using Coteditor or similar create a file on your Desktop and call it:

myscript.command.sh

Then enter your lines of code, for example:
cd /
open https://google.com
exit

You can leave out the usual #!/bin/sh part on the first line.

Then make it executable, by running chmod from the MacOS Terminal:
cd /
cd /users/yourusername/desktop
chmod +x myscript.command

Finally, set it to always open in Terminal by right-clicking on the file, select “Get info”, select “Open with” and then select Terminal.

Test your shell script by double-clicking on it, you should see Google. Adding ‘exit’ as the last line will avoid the ‘Process Completed’ message, and close the window. Check your Terminal preferences settings also… default/shell - when the shell exits.

Create a clickable script

Using Coteditor or similar create a file on your Desktop and call it:

myscript.command.sh

Then enter your lines of code, for example:
cd /
open https://google.com
exit

You can leave out the usual #!/bin/sh part on the first line.

Then make it executable, by running chmod from the MacOS Terminal:
cd /
cd /users/yourusername/desktop
chmod +x myscript.command

Finally, set it to always open in Terminal by right-clicking on the file, select “Get info”, select “Open with” and then select Terminal.

Test your shell script by double-clicking on it, you should see Google. Adding ‘exit’ as the last line will avoid the ‘Process Completed’ message, and close the window. Check your Terminal preferences settings also… default/shell - when the shell exits.