you mean save the script .sh then sudo that .sh file?? because i did that and nothing happens.
echo "/full/path/to/script"|root