As I have mentioned in the previous section, very often you don't really need to make an interactive contact with the program you want to run under PBS, even if the program requires some interactive input. If the input does not depend on the program's output, you can simply use the ``here-input'' feature of the shell.
The ``here-input'' is constructed in the following way:
$ my_command << EOF one_line_of_input another_line_of_input EOF
Here is an example of a simple script that utilizes this feature:
[gustav@bh1 PBS]$ cat bc.sh #!/bin/bash bc << EOF 2 + 2 3 - 1 scale=10 3.14 - 2.17 EOF exit 0 [gustav@bh1 PBS]$ ./bc.sh 4 2 .97 [gustav@bh1 PBS]$The program
bcis an interactive UNIX calculator. But here, instead of typing the stuff interactively, we tell shell to type it for us: everything until the line that begins with
We can submit this job to PBS and it will work the same, with the only difference that the output is going to be written on a file:
[gustav@bh1 PBS]$ qsub bc.sh 12626.bh1.avidd.iu.edu [gustav@bh1 PBS]$ ls bc.sh bc.sh.e12626 bc.sh.o12626 job.sh xterm.sh [gustav@bh1 PBS]$ cat bc.sh.o12626 4 2 .97 [gustav@bh1 PBS]$