Shell Script Files
Creating a Shell Script File
A shell script file can be created using any text editor.
If you would like to create a shell script file using a command line interface (CLI), you can use the touch command to create an empty file.
For example, to create a shell script file named my-script.sh, you would execute the following command in your preferred CLI.
touch my-script.sh
Additional information about Unix shell commands can be found in the Unix Commands guide.
File Extensions
The extension of your shell script file will vary depending on the shell you plan to execute it with and your personal preferences.
Most shell scripts use the .sh extension, for example my-script.sh.
If you are using the Bash shell, you can also use the .bash extension, for example my-script.bash.
If you are using the Z shell, you can use the .zsh extension, for example my-script.zsh.
You could also have a shell script file with no extension at all, for example my-script.