Watch for file changes in Linux
Polling like this is a very inefficient mechanism, but for pseudo-files in /sys/, you may find that the usual kernel interfaces as used by inotifywait and the like don't get notified of changes in the same way that they do for real storage-backed files.  So it may be that you need to poll, unfortunately.  But do check, for the files you care about.
There doesn't seem to be any value creating shutdownSignal to immediately use - simpler to just insert the value directly:
while [ $(&lt;/sys/class/gpio/gpio$SHUTDOWN/value) = 1 ]

sudo is intended for interactive use, and doesn't work well in scripts.  I think it's better to assume (or check) that the script is invoked with sufficient capabilities to do the work it needs to do.
Don't forget to add a shebang line (#!/bin/bash).