On Thu, March 22, 2007 2:08 pm, John Oliver wrote:
> On Thu, Mar 22, 2007 at 01:51:35PM -0700, James G. Sack (jim) wrote:
>>
>> It appears that you  didn't grasp the significance of what Greg said
>> about the '&&' separating your commands.
>>
>> If you want to:
>>   try A, and then if that works try B, and then if that works try C
>>   use
>>     A &&
>>     B &&
>>     C
>> if you want to:
>>   try A, and then (always) try B, and then (always) try C
>>   use
>>     A
>>     B
>>     C
>
> Ahhh!
>
> I thought the && would just move on to the next command after the
> completion, not necessarily the successful completion, of the first
> command.  And that's what I want... I want it to try to install libgcc
> first, and only after that's complete, one way or the other, to move on
> to the next RPM command.
>
> I need to look up bash characters :-)
>
>

OR (||) quits if the first is true, but checks the second if the first is
false. AND (&&) quits if the first is false but checks #2 if the first is
true.

Their clever use to do conditionals in command lines is further obscured
by the fact that most posix programs return 0 for success (FALSE).

I have always been ambivalent about this bit of cleverness, because I
distrust cleverness in programming in the first place, and because I fear
that if I have to move my lips when I puzzle it out as I write it, then
the next person to read it might just "correct" it into the third circle
of hell. But it does work if you get it right.

-- 
Lan Barnes

SCM Analyst              Linux Guy
Tcl/Tk Enthusiast        Biodiesel Brewer


-- 
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list

Reply via email to