Hi chaps,
I've noticed in Ubuntu and FC17 I get strange behaviour with catching traps when I run my scripts in the "Terminal" accessed via the GUI.
EG:
This is to run a timer in a script to run a command every X seconds. Really dirty way of "multitasking" in bash.
When I ssh to the machine from within the terminal, it runs fine.
I've diff'd a few things like env outputs but don't see anything obvious.
Am I missing something basic here? SHELL is /bin/bash so I presume the subshell command runs properly.
I've noticed in Ubuntu and FC17 I get strange behaviour with catching traps when I run my scripts in the "Terminal" accessed via the GUI.
EG:
Code:
#!/bin/bash
sleeper(){
echo "TRAP!!!"
( sleep 5 && kill -ALRM $$ ) &
}
dieclean(){
echo "Goodbye!"
sleep 5
exit 0
}
trap sleeper ALRM
trap dieclean INT
sleeper
while :
do
echo "nothing"
sleep 1
done
This is to run a timer in a script to run a command every X seconds. Really dirty way of "multitasking" in bash.
When I ssh to the machine from within the terminal, it runs fine.
I've diff'd a few things like env outputs but don't see anything obvious.
Am I missing something basic here? SHELL is /bin/bash so I presume the subshell command runs properly.
Last edited: