in reply to exec with cleanup
#!/bin/sh first_program args1 second_program args2
Alternatively, you could take advantage of the fact that END blocks are executed in the inverse order that they are defined, so if the very first END block your script encounters calls the exec, it will be the last bit of code run on cleanup. (see docs: http://www.perldoc.com/perl5.8.4/pod/perlmod.html#BEGIN%2c-CHECK%2c-INIT-and-END.
|
|---|