Shell #!/usr/bin/env bash zip -r target.zip target_dir/ if [ $? -eq 0 ]; then echo "Success" else echo "Failed" fi Python #!/usr/bin/env python import commands status = commands.getstatusoutput("zip -r target.zip target_dir/")[0] if status == 0: print "Success" else: print "Failed"
Shell
Python