Redirecting stdout to a file you don't have write permission on
I am creating a script to change the brightness of my laptop. I discovered that I can do this using
echo 1000 > /sys/class/backlight/intel_backlight/brightness
for example. But I must to do this as root, not with
sudo command. Well, I created the file
echo "$1" > /sys/class/backlight/intel_backlight/brightness
and now I can execute it with
brilho 1000. But the problem is the permission. This does not work with
sudo brilho 1000 neither
brilho 100. Again I have to change to root.
So, I would like to know how to improve this to facilitate my job.
Regards and thanks.