Aehhhm ... this is Shell - not C++
But you can use the 'trap' shell-builtin to catch signals (see the bash manpage for details). E.g. if you want to display the value of the variable 'dummy' whenever you send signal SIGUSR1, add this to the top of your script:
trap 'echo $dummy' SIGUSR1
Now start the script and get its PID. Let's say it has PID 123:
kill -SIGUSR1 123