If your web browser formats this page incorrectly, try viewing the page source. In netscape 4, click the view menu, then click page source. The first line of a shell script is supposed to be: #!/bin/sh or #!/usr/bin/perl or something like that. But the following do not work; they result in error messages and the shell script does not run: #!/bin/sh # bourne shell #!/bin/sh# So it is important to not have a comment or any extra characters on the first line. But you can have command line options for the script interpreter program, such as: #!/usr/bin/perl -w The next line: #!/bin/sh $# results in an error message which indicates that it is looking for a program named '$#'. This suggests that $-expansions do not apply. If all else fails, delete the first line, and let the new first line be just like any other line. In that case the shell script will be run in the current shell, which is probably bash. In other words, the first line of a shell script always gets executed twice. The first time it is executed by the kernel, which reads the first line to figure out which shell to use. Then that shell runs the shell script, starting with the first line. So the first line is executed once by the kernel and once by the shell. However, the kernel does not execute the first line if the first line does not begin with '#!', and the shell regards the first line as a comment if it does begin with '#'; so in practice the kernel or the shell or both will regard the first line as a comment, and the first line does not actually get executed twice. But if you are particularly perverse, you could invent a shell which did execute lines beginning with '#!', and then you could write shell scripts where the first line would be executed twice. This would be a stupid thing to do, but it is theoretically possible. Note that when the first line of a shell script begins with '#!', the first line is executed by the kernel, not the shell. That is why the usual shell rules about syntax, punctuation, spelling, variables, etc do not apply to the first line; the first line is subject to kernel rules instead. And errors on the first line are kernel errors, not shell errors. Except that the bash man page says that if the current shell is bash, then bash takes care of the first line, not the kernel. The following first line does not work: #!xc -s but the next line does: #!/usr/local/bin/xc -s so I guess you have to use the full path.