A script is a (bash) program. It consists of grouping a command set in a file and giving the rights in execution of this file.

The first line of the script is a particular line, indicating to the operating system that it is the interpreter to use. In this case, the line starts by #! followed by the path to the shell.1

In bash, any line starting with a # is not interpreted beyond that # .

# indicates the start of a comment.

A command line in bash ends either by a carriage return (\n), either by a semi-colon (;).

If a command must continue to the next line, the continuation character \ must be used.

echo Hello
# a comment
echo a; echo b
echo hello\


cat > script1 << END
echo Hello
chmod +x script1

  1. this can be obtained via the which command