Open main menu

CDOT Wiki β

Changes

Tutorial10: Shell Scripting - Part 1

153 bytes added, 08:36, 9 July 2020
Creating & Executing Shell Scripts
Once you have planned your shell script by listing the sequence of steps in your script, you need to create a file that will contain your Linux commands. '''NOTE:''' Avoid using filenames of already existing Linux Commands to avoid confusion. Using shell script filenames that include the file extension of the shell that the script will run within is recommended.
[[Image:shebang.png|thumb|right|400px|The '''shebang line''' <u>must</u> appear on the '''first line''' and at the '''beginning''' of the shell script.]]If you are learning Bash scripting by reading other people’s code you might have noticed<br>that the first line in the scripts starts with the #! characters and the path to the Bash interpreter. This sequence of characters (#!) is called '''shebang''' and is used to tell the operating system which interpreter to use to parse the rest of the file. Reference: https://linuxize.com/post/bash-shebang/
The '''shebang line''' <u>must</u> appear on the '''first line''' and at the '''beginning''' of the shell script, otherwise, it will be treated as a regular comment and ignored.
13,420
edits