MAD9 is also often used to create table files of optical functions, tracking co-ordinates, transfer matrices and other quantities. Normally the user specifies their names in input commands. These files are not discussed on this page. See the Madtomma pages for information about one way of using these files.
mad9These assume, respectively, that the input commands are going to come from the terminal or from a file test.mad. Both stdout and stderr outputs then appear in the same terminal window. This is of limited application since you can't look back very far to see what came out earlier and the output is lost once it has moved up your screen.
mad9 < test.mad
mad9 > test.mouThese will send all the standard output to test.mou. (In the second case, input will come from test.mad.) However you will continue to see the standard error (stderr) output on the terminal. However this is not very satisfactory either since any results computed by MAD only appear in test.mou and you may want to know what they were before you decide what to do next.
mad9 < test.mad > test.mou
If the file test.mou already exists, you need to delete it before doing this.
In the Bourne shell, the syntax for this is the same.
mad9 >& test.mouwill send both stderr and stdout to the file test.mou. That way you can pick through all results and/or debug your job at leisure afterwards, e.g. with an editor, or you could get an analysis of the CPU time. However, while MAD9 is running, you are completely blind to what is going on: you don't even know if the job is going badly wrong and should be stopped.
mad9 < test.mad >& test.mou
In the Bourne shell, the syntax for this is
mad9 2> test.mou
mad9 < test.mad 2> test.mou
mad9 | tee test.mouwill send both stderr and stdout to the terminal but the stdout will also go to thefile test.mou. That way you can pick through all results and/or debug your job at leisure afterwards, e.g. with an editor, or you could get an analysis of the CPU time. However, while MAD9 is running, you are completely blind to what is going on: you don't even know if the job is going badly wrong and should be stopped.
mad9 < test.mad | tee test.mou
In the Bourne shell, the syntax for this is the same.
mad9 |& tee test.mouThis way you see everything (stdout and stderr) whizz by on the terminal but you collect it all in the file as well.
mad9 < test.mad | & tee test.mou
If you give the option -a to the tee command, test.mou will be appended to and not over-written.
I have not managed to find the syntax for this in the Bourne shell: if you can, help please tell me.
mad9 |& tee test.mou | moreThis way everything (stdout and stderr) does not whizz by on the terminal but you are able to let one screen's worth go by at at time by pressing the spacebar (this might be keyboard-dependent). This way, you have time to look at what is happening and you collect all the output in the file test.mou as well.
mad9 < test.mad |& tee test.mou | more
I have not managed to find the syntax for this in the Bourne shell: if you can help, please tell me.
mad9in an Emacs terminal buffer. Then you can scroll back and/or save the contents using Emacs commands. This used to be the way I used MAD Version 8.
mad9 < test.mad
mad9 < test.madthen MAD9 will stop when it encounters a STOP; command in the file test.mad. If you wish to continue typing more commands, it is better to start mad9 without the input re-direction and then give the MAD9 command
call,file="test.mad"so that MAD9 simply passes control back to the terminal input stream. I.e., any STOP; command in test.mad will NOT cause mad9 to stop. You can then call other files, paste chunks of input at the terminal prompt or type commands manually.
JMJ
Modified 6/3/2000.