Any line that begins with a #
is a comment in many languages and is ignored by the interpreter (perl
etc.).
However, if the first line of a script in Linux begins with a #!
(shebang as it is called), it is not a comment but a directive to the program loader to actually run the program specified after #!
and pass it the name of your file as the last argument.
For example, if the first line is
#!/usr/bin/perl -w
it means the shell will actually invoke /usr/bin/perl -w /path/to/the/script
and you don't need to specify a program to run this script, you can run it using
/path/to/the/script
if you have the permission to run it and it is located on a filesystem supported for execution and the file has the permission to be executed.
For the interpreter, however, this line is always just a comment, so if the script is executed as:
perl /path/to/the/script
then the line has no effect. (Thanks to Ruslan for pointing this out).
Be warned that #
is not always indicative of a comment. For example, a statement beginning with a #
in C is pre-processor directive and not a comment.
In your case, the line is a comment and will be ignored while execution.
Update:
The file you are talking about is a menu.lst
for which a comment is a line beginning with ##
and not #
. (Source)
#
in/boot/grub/menu.lst
file. – jobin May 06 '14 at 18:54