First, you should become familiar with do-files. Now that you know what do-files are, and how to run them interactively from within Stata, you can also use them to run background Stata batch jobs in Unix. The first tells Stata to run in batch mode. Stata will execute the commands in filename.do , and will automatically save the output in filename.log . The second uses the Unix input redirection symbol to send each line in filename.do to Stata, just as if you typed that line interactively.
Any output is redirected to filename.log .
In the second method, Stata does not know that the commands it is receiving are coming from a file. As far as Stata is concerned, you are typing every command in filename.do on the Stata command line. Finally, you may wish to start a batch Stata job, log off from your terminal, and log back in later to retrieve the output. Type man nohup at your Unix prompt for more information.