The script should start with
This tells your shell that it should interpret it with the bash interpreter.
Then, you have to make it executable with this command:
SCRIPTNAME should be replaced with the name of your script, of course.
It makes sense to give your script the extension .sh for distinction purposes in a file browser.
If you want to execute the script, you have to execute it with the path it resides in (either relative or absolute path), or symlink it from a directory that's in your $PATH variable and then execute it without the directory part of the path.
If you navigate to the directory it resides in, you can execute it by calling
You can also run a bash script from a Finder if you set the program to open it with to Terminal.app (and check "Always open with" while you're at it). Then, you can doubleclick it from a Finder and so forth. That's by extension, so there's a reason to give it the .sh extension for ya.