To be more specific:

Edit a plain text file with any editor (Not a wordprocessor.)

The name you choose for the file will be the name of your new command.

Make sure the first line of the file is this (without the indent):

        #!/bin/sh

if it's a plain old Bourne shell script.  If you use any of bash's
special features (you probably won't), then the first line instead
would be:

        #!/bin/bash

Make sure the file has permission to be read and executed:

        chmod 755 your-new-filename-here

Make sure you put the file somewhere in your command search PATH.

        echo $PATH

to see where it looks for commands.  Maybe move the file into a
suitable place.  E.g.

        mv your-new-filename-here /usr/local/script/.

You can always run the script by saying:

        sh your-new-filename-here

giving the full pathname to the file.

Things that you can't do in Windows?

Well, text enclosed in backquotes (e.g.: `ls`) is replaced by the
output of running the command right at that point.

You can redirect stderr separately from stdin:

        ls > saved-list-of-files
        ls -l tooth-fairy 2> saved-list-of-error-messages

and all logical combinations of the two.  And lots more.  Like more
than 10 parameters, powerful additional tools (like sed, grep, xargs,
find, awk, ...).

My rule of thumb, having written lots of both, is that a shell script is
usually about 10 times easier to write than a similar but less powerful
and less robust DOS batch script.

Have fun,

luke

--
SLUG - Sydney Linux Users Group Mailing List - http://www.slug.org.au
To unsubscribe send email to [EMAIL PROTECTED] with
unsubscribe in the text

Reply via email to