output = subprocess.check_output(\"./mount.sh\", shell=True)
print output
if output == \"expected_String\":
print \"Hurray!\"
(The print comm
I believe the problem is your output contains additional new line character at the end. You can fix it by calling .strip()
to remove those:
output = subprocess.check_output("./mount.sh", shell=True)
output = output.strip()
Consider the following interactive session:
>>> s = '''hello\n'''
>>> s.endswith('\n')
True