Below is my shell script which simply execute a url like this http://example.com:8080/beat and parse the response and verify certain conditions on it. If that condition is met, then exit successfully out of the shell script using exit 0.#!/bin/bashset -eCOUNT=60 SUM_SYNCS=0SUM_SYNCS_BEHIND=0HOSTNAME=$hostname  echo $HOSTNAMEwhile [[ $COUNT -ge 0 ]]; do#send the request, put response in variableDATA=$(wget -O - -q -t 1 http://$HOSTNAME:8080/beat)#grep $DATA for syncs and syncs_behindSYNCS=$(echo $DATA | grep -oE 'num_syncs: [0-9]+' | awk '{print $2}')SYNCS_BEHIND=$(echo $DATA | grep -oE 'num_syncs_behind: [0-9]+' | awk '{print $2}')echo $SYNCSecho $SYNCS_BEHIND#verify conditionalsif [[ $SYNCS -gt 8 && $SYNCS_BEHIND -eq 0 ]]; then exit 0; fi#decrement the counterlet COUNT-=1#wait another 10 secondssleep 10doneI am able to execute the above shell script from Python subprocess module successfully as shown below -  proc = subprocess.Popen(shell_script, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, executable='/bin/bash') (stdout, stderr) = proc.communicate()if proc.returncode != 0:    # log an error hereelse:    # success log hereBut what is happening here is -  If you see my shell script I am exiting out of the shell script using exit 0 which is a successful exit I guess and somehow in my Python code, it is logging an error after executing that shell script? Meaning it is going inside if statement somehow.So is there any way, I can replace exit 0 with some other successful exit call in shell script so that Python script can identify that, it's a successfull exit?I don't want to modify Python script code..
How to exit out of the shell script successfully so that python subprocess think it is successfull exit?
linux;bash;shell;python;exit