samedi 21 février 2015

Python if is returning wrong

I have a if statement to check if two variables returns the same, which means the client exist. Right now the if statement should be true, I dont understand why it doesn't.



client_status= subprocess.check_output("nsostatus | grep %s | awk '{ print $1 }'" %client_name, shell=True)
print client_name
print client_status

if client_name == client_status:
print "client already exist"
else:
print "client doesn't exist"


When I run the script, this is what I get:



nagios-client
nagios-client
client doesn't exist

Aucun commentaire:

Enregistrer un commentaire