Fängt Signale und andere Ereignisse ab.
Definiert und aktiviert Prüfroutinen, die ausgeführt werden, wenn die Shell
Signale oder andere Bedingungen empfängt.
ARGUMENT ist ein Kommando, dass gelesen und ausgeführt wird, wenn die Shell
die Signale SIGNALBEZEICHNUNG empfängt. Wenn ein ARGUMENT oder »-« fehlt
(und eine einzelne SIGNALBEZEICHNUNG angegeben ist), wird jedes angegebene
Signal auf den ursprünglichen Wert zurückgesetzt. Wenn ARGUMENT eine leere
Zeichenkette ist, wird jede SIGNALBEZEICHNUNG von der Shell und das
aufrufende Kommando ignoriert.
Wenn eine SIGNALBEZEICHNUNG »EXIT (0)« ist, wird ARGUMENT beim Beenden der
Shell ausgeführt. Wenn eine SIGNALBEZEICHNUNG »DEBUG« ist, wird ARGUMENT
vor jedem einfachen Kommando ausgeführt. Wenn eine SIGNALBEZEICHNUNG
»RETURN« ist, wird ARGUMENT jedes mal ausgeführt, wenn eine Shell-Funktion
oder durch ».« oder »source« ausgeführtes Skript beendet wurde. Wenn eine
SIGNALBEZEICHNUNG »ERR« ist, wird ARGUMENT jedes mal ausgeführt, wenn bei
aktivierter Option »-e« ein Kommandoabbruch die Shell beenden würde.
Wenn keine Argumente angegeben sind, wird eine Liste von Kommandos mit den
zugehörigen Signalen ausgegeben.
Optionen:
-l
[tab]
Gibt eine Liste der Signalnamen und der zugehörigen Nummern aus.
-p
[tab]
Zeigt die »trap«-Kommandos, die mit jeder SIGNALBEZEICHNUNG
[tab]
verbunden sind.
Jede SIGNALBEZEICHNUNG ist entweder ein Signalname in <signal.h> oder eine
Signalnummer. Bei den Signalnamen ist Groß- und Kleinschreibung egal und
das Präfix »SIG« ist optional. Ein Signal kann mit »kill -signal $$« an die
Shell gesendet werden.
Rückgabewert:
Gibt »Erfolg« zurück, außer SIGNALBEZEICHNUNG ist ungültig oder eine
ungültige Option wurde angegeben.