On Sun, Sep 27, 1998 at 07:05:17PM +0100, David Bobroff wrote:
> I would like to write a script to automate the following sequence of
> commands in Linux:
> 
> tex \&opustex jobname
> opusflex jobname
> tex \&opustex jobname
> dvips -o jobname.ps jobname
> gv jobname
> 
> I'm new to Linux and have not yet been able to find the correct syntax for
> such a script.  Could someone reveal the secret to me?

Well... Just put all the commands above in a file, make itexecutable
and run it by typing it's name. ;)

Since you use a parameter (the jobname) and want the script to stop
executing commands when an error occurs, it is a little more advanced, but
I believe that the following might work just fine:

#!/bin/sh
set -e
jobname=3D$1
tex \&opustex $jobname
opusflex $jobname
tex \&opustex $jobname
dvips -o $jobname.ps $jobname
gv jobname

set -e tells the script to stop immediately when a command fails.
jobname=3D$1 creates variable named $jobname which contains the first
parameter with which you invoked the script. The first line
#!/bin/sh IS important, it tells the loader which shell to use for
executing the script.

You have to make the script executable (chmod 755 scriptname) and place
it in your search path to run. You might have to reload the path cache
in your current running shell by saying "hash -r" or "rehash".

        -Klaus Knopper  mailto:[EMAIL PROTECTED]
                        http://home.pages.de/~knopper
        "Disk Space... The final frontier!"

-- 
Approved [and MIME&PGP unedited] by mutex-owner

Reply via email to