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

17 lines
218 B
Bash

#!/usr/bin/env bash
# removeing a set trap
trap "echobyebye" EXIT
count=1
while [ $count -le 5 ]
do
echo "Loop #$count"
sleep 3
count=$[ $count + 1 ]
done
#移除捕捉
trap - EXIT
echo "I just removed the trap"