Gentoo Archives: gentoo-amd64

From: Martin Herrman <martin@×××××××.nl>
To: gentoo-amd64@l.g.o
Subject: Re: [gentoo-amd64] How to use &&
Date: Sun, 04 Jan 2009 14:35:56
Message-Id: 40bb8d3b0901040635x50bbbc8v365268c0b12082ad@mail.gmail.com
In Reply to: Re: [gentoo-amd64] How to use && by Maciej Kazulak
1 On Sun, Jan 4, 2009 at 3:31 PM, Maciej Kazulak <kazulakm@×××××.com> wrote:
2
3 > The reason only the first command was executed can be that it returned a
4 > non-zero exit status. If you want to make sure every command gets a chance
5 > to execute, regardless of what the exit status of the previous one is,
6 > substitute '&&' with ';'. Check this out:
7 > box% false && echo "will not be echoed"
8 > box% false; echo "hello"
9 > hello
10 > box%
11 >
12 > That's how bash evaluates logic expressions. There's even a fancy word for
13 > it i think. Point is it will execute commands only to the point where it can
14 > determine the logic result. So above if the first element is false there's
15 > no need to execute echo as the logic result is already known to be false.
16
17 hehe, didn't think about using a ; that would work as well :-)
18 (but if you have A to Z, your command will be much longer than just
19 the for-loop in script 1)
20
21 BTW, you might want to output all to a file using >> "/home/Fred
22 Music/output.log" and view it using a "tail -f /path/file". Run
23 mp3gain quiet and grep the output.log file for errors/failures..

Replies

Subject Author
Re: [gentoo-amd64] How to use && Paul Stear <gentoo@××××××××××××.com>