How do I trap EXIT in a solaris 11 shell script?
问题 man signal.h indicates there's no SIGEXIT in Solaris 11. How can I trap it in my shell scripts? Or how can I simulate the old behavior of traping SIGEXT? 回答1: Why are you looking to the C API manual for a shell feature ? You definitely can trap the SIGEXIT signal under Solaris 11 shells (at least ksh93, bash and sh). $ cat /etc/release Oracle Solaris 11.1 X86 Copyright (c) 1983, 2012, Oracle and/or its affiliates. All rights reserved. Assembled 19 September 2012 $ cat /tmp/z #!/bin/ksh trap