[mdlug] UNIX tips: Learn 10 good UNIX usage habits
Robert Citek
robert.citek at gmail.com
Mon Mar 10 01:52:30 EDT 2008
On Sun, Mar 9, 2008 at 5:06 PM, Aaron Kulkis <akulkis3 at hotpop.com> wrote:
> The "ultimate" example here
>
> cmdA && _cmdB_to_run_only_if_cmdA_fails ||
> cmdC_to_run_only_if_either_cmdA_or_cmd_B_succeeds
Did you mean to switch the operators:
cmdA || _cmdB_to_run_only_if_cmdA_fails &&
cmdC_to_run_only_if_either_cmdA_or_cmd_B_succeeds
For example:
$ true || true && echo yes
yes
$ true || false && echo yes
yes
$ false || true && echo yes
yes
$ false || false && echo yes
Or did you mean cmdC_to_run_only_if_either_cmdA_or_cmd_B_fail.
For example:
$ true && true || echo yes
$ true && false || echo yes
yes
$ false && true || echo yes
yes
$ false && false || echo yes
yes
Regards,
- Robert
More information about the mdlug
mailing list