Using Coteditor or similar create a file on your Desktop and call it:
Then enter your lines of code, for example:
You can leave out the usual #!/bin/sh part on the first line.
Then make it executable, by running chmod from the MacOS Terminal:
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.