I was trying to bind a keyboard shortcut to my script. I tried binding it to keyboard shortcut from
System Settings>Keyboard>Shortcuts>Add Shortcut
I added new shortcut and as mentioned in this link I tried to add
bash /path/to/my/script
in the command section of the new shortcut. The permission is right.
It runs when I run from terminal.
I tried binding it using compiz-config-settings as mentioned in the answer given by n3rd. But it did not work.
this is my script.