Update bash.py

add method for checking return code success or failure and trim stdout and stderr of whitespace when returning