katel@amdcad.AMD.COM (Kate Lowenstein) (05/17/88)
Is it possible to send a signal from a here document to be processed by a TRAP command in a Bourne shell script? I have been unable to figure out a way to do this. I have a Fortran interactive test that I am trying to write a script for so the computer does the work, not the tester. The Fortran 'pause' and 'stop' statements are being tested. They interact with the system: the system sends out a pause, and the operator is supposed to respond with a 'go'. Interactively, I have no problems: when I get to the 'stop' statement, the test finishes. I have set up a Bourne shell script with a here document to send the 'go' commands, and it works fine until it gets to the 'stop' command. Then the system prints a message: "To resume execution, type: kill -15 PID" I know about using $$ to substitute for PID number, but the wrong PID number is getting substituted. The number used by the $$ is the number for the whole shell script; the number I need is for the execution step within the shell script. So I thought if I could send an 'interrupt' signal from the here document and have it processed by the TRAP command, I could do a ps, and extract the correct PID number, and substitute that correct number in the here document, and my test would finish correctly. But I have been unable to figure out HOW to send a signal. Is this confusing? Maybe if I copy from a recent script: $ /bin/sh/-x rt257 . . . 257.x go\r go\r go\r go\r go\r . . . PAUSE: To resume execution, type: kill -15 29659 % ps 29659 /bin/sh/sh -x rt257 29680 257.x . . . What I need to do with my here document is to send an interrupt signal to be handled by a TRAP command at the beginning of the script. Is it possible to do what I am trying to do???? Thanks Kate Lowenstein