Quote Originally Posted by maxIT
Quote Originally Posted by RedWagon
I don't know much about writing scrips but it looks like # is for comments. What does #!/bin/bash mean?
# is a comment
#! also known as the 'sha-bang', at the head of a script tells your system that this file is a set of commands to be fed to the command interpreter indicated, being in this case 'bash' but could even be perl (#!/usr/bin/perl) ,tcl (#!/usr/bin/tcl) or something else.
Yes, # is for comments, EXCEPT in the case of the #!, which is as described.

Also, I forgot to mention

You need to do

$ chmod ugo+rx your_script.sh

to make it executable. (Note the .sh file extension is entirely optional, but useful)