The bash example should have set -e or #!/bin/bash -e so that it will exit on error. That or the rest of the languages also shouldn't bother to check for errors. Also rather than invoking another shell use let and do let STATE=1-$STATE just like all the other programs. And why does bash need to have comments. Maybe it was a subtle joke that C doesn't get comments, but bash does :D in which case well played.
#!/bin/bash -e
STATE=1
while : do
echo $STATE > /sys/class/leds/beaglebone\:green\:usr0/brightness
let STATE=1-$STATE
sleep 2
done
While all of the programs can be made smaller in size the bash script is probably the default way that the script would be tossed together. Bash has a ton of problems, but sadly between it and the standard unix commands you can get the job done too quickly and easily.
In predicate contexts (which means return code in bash) like if, while or the left hand side of '&&', consider using (( )) - this has an exit code of 0 if the arithmetic expression is true (non-zero) and 1 otherwise. Use it like this:
let x=3*3
if (( x > 5 )); then
echo greater than five
else
echo less than or equal to five
end