Re: [Hampshire] Bash pipe creates infinite loop - why?

Top Page

Reply to this message
Author: Russell Gadd
Date:  
To: Hampshire LUG Discussion List
Subject: Re: [Hampshire] Bash pipe creates infinite loop - why?
Hugo Mills wrote:
> On Thu, Apr 03, 2008 at 08:11:37PM +0100, Richard Brown wrote:
>>> Thanks for the info. Minor question: I read bcrypt's documentation (man
>>> page and web site) but I don't think it said anything about return codes.
>>> Maybe there's some other way of discovering this?
>> Everything returns. Bash stores the return code of the last run
>> command in $?. 0 is win, not 0 is an error of somekind. I can't
>> remember now why this is the wrong way around (0 being false > 0 being
>> true).
>
>    Because there's a large number of ways of failing, but only one way
> of succeeding, so success (true) is 0, and failure (false) is non-zero.

>
>    Hugo.

>
>

Yes this is the reason I am not so keen on using bash to sanitise the
input - there are many ways of failing, and I can't be sure what other
conditions bcrypt might fail on. If I miss one I'm going to blow up the
system. Having said that I might resort to doing this and trying to test
to destruction :)

Russell