Shell Scripts

Adam Myrow amyrow at midsouth.rr.com
Sat Nov 8 08:35:13 EST 2003


It doesn't matter what you call a file in Linux.  It will be executed as
long as it has execute permission.  You don't need extensions, though a
lot of people do use .sh.  The most important thing to have in a script is
the shell to run as the first line.  This typically looks like:
#!/bin/sh
This tells the system that this script should be interpreted by /bin/sh.
Normally, a number sign is a comment character, but when followed by the
exclamation mark and on the first line of a script, it gets the special
treatment.  If you replaced that line with:
#!/usr/bin/perl
instead, the script would be processed by perl.  It's generally a good
idea to give the complete path.

As to your second question, parameters are called $1, $2, and so forth in
shell scripts.  $0 is the command name, so you can tell what a command was
called by the user.  Hope this helps.





More information about the Speakup mailing list