bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Exit status of "if" statement?


From: Maarten Billemont
Subject: Re: Exit status of "if" statement?
Date: Tue, 10 Apr 2012 09:38:14 +0200

On 10 Apr 2012, at 08:26, Barry Margolin wrote:
> 
> if [ $status = 0 ]

As an aside, I don't think it's a good idea to recommend comparing numbers 
using string comparison operators.

if (( status == 0 ))

But if you wanted to treat them as strings for the sake of code simplicity, 
just go the case route:

case $status in
0) ... ;;
1) ... ;;
*) ... ;;
esac

Attachment: smime.p7s
Description: S/MIME cryptographic signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]