permission denied for file write

Redirections such as > or | are performed by the running shell, before it invokes sudo.

You have to either use

sudo sh -c "echo blah > /proc/blah", or run a root shell with sudo -s.

via linux – Bash: permission denied for file write – Super User.

This had me stumped until the greatness of google divined the answer and why my user script couldn’t write to a root owned file using plain old sudo.  After figuring this out I also realized I don’t need to write to a root owned file after all but I found this solution interesting.