OSU Navigation Bar

The Ohio State University

Department of Statistics

Cockins Hall
rollover image OSU Statistics
            Home

design element

OSU Statistics

Home

News

Research & Consulting Groups

People

For Visitors

For Prospective Students

For Current Students, Staff & Faculty

Contact Us



rollover image

For Current Students & Faculty

rollover image

Courses

rollover image

Links

rollover image

Computer Support

rollover image

Internal Documents

rollover image

webmail

Writing Shell Scripts

So you want to run several things in succession? There are several ways to do this, but I'll concentrate on the shell script method here.

A shell script is simply a list of commands that you put in a file and then execute. You can put any command in this file that you can normally run. Generally the file will look something like this:

#!/bin/csh
Splus BATCH file.s
a.out < infile1 >& outfile1
sas < prog.sas
a.out < infile2 >& outfile2

Create this file and make it executable by: chmod 700 script (The a.out, sas, and Splus commands are just examples, put whichever commands you want in the script.)

Now you can run this file like any other command, but remember to renice it, by: renice -u your_username

Notes:

  1. There are no ampersands after the commands in the script, if there were the commands would not run sequentially, but all at once. This would be bad.

  2. The #!/bin/csh makes sure you run the shell you're used to. If you want the commands to start running later, you can insert sleep statements at the beginning: sleep 1 will wait for 1 second, sleep 7200 will wait for two hours.



If you have trouble accessing this page, or need an alternate format contact webmaster@stat.osu.edu.