myname.command script on OSX 10.8 from some app. It has Bash script, with signature (she-bang).
What other script formats can be inside
*.command files? Maybe AppleScript or some others?
unix/linux world (afaik mac is running a
unix variant) you wouldn't need any file extensions for programs, but it's good practice to give
bash scripts the
.sh, python scripts the
.py, perl the
.pl (etc.) extension for humans to identify those scripts without viewing the script checking the she-bang line. (I don't know if there are specific extensions for mac)
The important part is the executable flag
chmod +x ./myscript.sh which marks the file as a program that can be executed.
she-bang line is the first line in a file and starts with
#! followed by the fullpath pointing to an executable
On some Unix/Linux installations it could be possible that
bashor any program is not located in
/usr/bin/ but in
/opt/python3.6 so the she-bang
#! /usr/bin/python wouldn't start the program. So basically it's another good practice to start she-bang line with
#!/usr/bin/env followed by the program you want to start ie.
#!/usr/bin/env bash or
This will look into the environment vars (PATH) for that given program.