Special characters
We have already used some of these special characters in the chapters by giving a hint of what was their meaning. Now, we will be closely looking at each of them and examining their special value for the shell and how they can be used in our scripts.
The hash character (#)
This represents a comment. Each line beginning with #
is taken as a and not interpreted by the shell. Let's have a look at the following script:
#!/bin/bash # I am a comment at the beginning of a line' ls # I am a comment after a command #I am a comment preceeding a command and so it is not interpreted ps
The first pound sign is not really a comment, but it is associated to the following exclamation mark and is interpreted as a sha-bang. The second line shows a typical comment line, the third a comment after a command, the fourth line is still a comment, and the ps
command is not interpreted and executed. Let's run it:
zarrelli:~$ ./comment.sh * 1 2 3 comment.sh
We see the output of the ls
command, but not...