shell-script-pt
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

herança de trap


From: Roberto
Subject: herança de trap
Date: Fri, 22 May 2015 15:37:11 -0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

Olá, sou novo em shell scripts e estou com a seguinte dúvida com relação a traps;

O manual do bash diz o seguinte:

   "Command substitution, commands grouped with parentheses, and
asynchronous commands are invoked in a subshell environment that is a
duplicate of the shell environment, except that traps caught by the
shell are reset to the values that the shell inherited from its parent
at invocation."


Se eu criar uma trap qualquer, digamos "$ trap 'echo teste' SIGINT" e usar "( trap )" terei a seguinte saída:

trap -- 'echo teste' SIGINT
trap -- '' SIGTSTP
trap -- '' SIGTTIN
trap -- '' SIGTTOU

Ao usar trap num subshell '( )' o sinal SIGINT não deveria ser resetado ao valor original ou eu entendi errado esse trecho do manual?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]