Gentoo Archives: gentoo-user

From: Adam Carter <adamcarter3@×××××.com>
To: "gentoo-user@l.g.o" <gentoo-user@l.g.o>
Subject: [gentoo-user] bash script question
Date: Mon, 18 Aug 2014 08:55:03
Message-Id: CAC=wYCHQMa77RxBpFYs878T7j61PiMWZUWoXLjc2QnwpU794DA@mail.gmail.com
1 I want to use an if/then that tests for the existence of a string in 4
2 files. Usually I do this by checking the exit code of grep, when i'm
3 checking a single file. However, I cant get the syntax right for multiple
4 checks.
5
6
7
8 To troubleshoot I’ve dropped back to just checking two files, and i’ve
9 tried things like
10
11
12
13 If [ $(grep blah file1.txt) –a $(grep blah file2.txt) ]; then
14
15
16
17 But this matches if grep fails both times as well as when it matches both
18 time. Any ideas?

Replies

Subject Author
Re: [gentoo-user] bash script question wraeth <wraeth@×××××××××.au>