Un*x terminal history wiper
That's a lot of shell commands to do very little.

You could replace all those shell commands to get the equivalent effect with just this:

rm ~/.bash_history; HISTFILE=


Let me explain step by step why this is equivalent:


cat /dev/null &gt; ~/.bash_history - truncate the file. Exactly the same as the shorter &gt; ~/.bash_history. This is pointless, because later you delete the file anyway.
history -c - clear the history. Pointless because later you delete the file anyway
history -w - write the content of the history to the file. Pointless because later you delete the file anyway
rm -r ~/.bash_history - delete the file, recursively. The recursive flag is pointless, as the history file is never a directory
exit - This is pointless, as the system function will exit automatically anyway


All this can be reduced to what I gave above, by benefiting from the fact that if HISTFILE is unset, history is not saved anywhere.

Btw, I don't understand why you need a gnome terminal at all. I think you can simply remove that special treatment. 

Lastly, using system is generally not recommended, it should be avoided as much as possible. If you must use it for some reason, you should call commands by their absolute paths, otherwise the program will be vulnerable to path injection attacks.