Ray Jones wrote:
> Can anyone explain to me why the following doesn't work?
> 
> If condition1 -gt condition2, then continue down the script otherwise, follow 
> the OR condition and echo something and then call a function. If I write it 
> as 
> follows, Bash ORs the test and the echo and then calls the function 
> regardless 
> of result.
> 
> [ cond1 -gt cond2 ] || echo something ; call function
> 
> 
> If I do it as follows, Bash ignores the OR section altogether and continues 
> down the script
> 
> [ condi1 -gt cond2 ] || ( echo something ; call function )

The one above should have worked. I'm guessing condi1 instead of cond1
is just a typo. Unless you really need a subshell, I probably would have
used something like this:

[ cond1 -gt cond2 ] || { echo something ; func ; }

It might have helped to see your actual code instead of pseudocode as
well. Hope this helps.

> This ignores the function call.....
> 
> [ cond1 -gt cond2 ] || echo something && call function
> 
> 
> ....and this calls the function regardless.....
> 
> 
> [ cond1 -gt cond2 ] || echo something || call function
> 
> 
> I finally broke down and used the if/then construct (I probably should have 
> started with that anyway), but it seemed that one of those should have 
> worked. 
> Any ideas?
_______________________________________________
PLUG-applications mailing list
[email protected]
http://lists.plug.phoenix.az.us/cgi-bin/mailman/listinfo/plug-applications

Reminder: All replies will go back to this mailing list. If you wish to send a 
reply to a specific person, please use the reply function and change the 
"To:" address to that person before sending.

Reply via email to