If I place this on the top the Bash script, Control+C doesn't work.
exit-function() {
echo "Hey hey!"
}
trap exit-function INT
But if I put it few lines after, then Control+C is trapped.
UPDATE:
If it's placed after source "$HOME/.rvm/scripts/rvm"
, then it works.
So if you source another file, trap INT
defined before won't work?
One of the scripts that's sourced by the rvm script sets a trap
which replaces the trap you set earlier. By setting one after the rvm script you're replacing the one it sets.