Gentoo Archives: gentoo-user

From: Richard Broersma Jr <rabroersma@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] OT - Question about conditionals and bash scripting
Date: Thu, 12 Oct 2006 20:54:29
Message-Id: 20061012204908.90404.qmail@web31808.mail.mud.yahoo.com
In Reply to: [gentoo-user] OT - Question about conditionals and bash scripting by Michael Sullivan
1 > I have a short script:
2 >
3 > #!/bin/bash
4 >
5 > while read LINE
6 > do
7 > whois $LINE | grep 'abuse' &> /dev/null
8 > if $? != 0; then
9 > echo "$LINE" >> noabuse.txt
10 > fi
11 > done < iplist
12 >
13 > I'm getting "command not found" on the if line. Have I not formatted it
14 > correctly? The script is supposed to append $LINE to a file if the
15 > return code of whois $LINE | grep 'abuse' returns false (not 0)...
16 >
17
18 Do you need to add
19 if test...
20 or if [ ... ]?
21
22 Regards,
23
24 Richard Broersma Jr.
25 --
26 gentoo-user@g.o mailing list

Replies

Subject Author
Re: [gentoo-user] OT - Question about conditionals and bash scripting Michael Sullivan <michael@××××××××××××.com>