linux-tutorial/codes/shell/控制/移除捕捉.sh

17 lines
218 B
Bash
Raw Normal View History

2019-10-29 18:22:19 +08:00
#!/usr/bin/env bash
2019-05-10 11:17:57 +08:00
# removeing a set trap
2019-10-10 08:56:31 +08:00
trap "echobyebye" EXIT
2019-05-10 11:17:57 +08:00
count=1
while [ $count -le 5 ]
do
2019-10-29 18:22:19 +08:00
echo "Loop #$count"
sleep 3
count=$[ $count + 1 ]
2019-05-10 11:17:57 +08:00
done
#移除捕捉
trap - EXIT
echo "I just removed the trap"