[gentoo-user] OT - Question about conditionals and bash scripting

2006-10-12 Thread Michael Sullivan
I have a short script: #!/bin/bash while read LINE do whois $LINE | grep 'abuse' /dev/null if $? != 0; then echo $LINE noabuse.txt fi done iplist I'm getting command not found on the if line. Have I not formatted it correctly? The script is supposed to append $LINE to a file

Re: [gentoo-user] OT - Question about conditionals and bash scripting

2006-10-12 Thread Richard Broersma Jr
I have a short script: #!/bin/bash while read LINE do whois $LINE | grep 'abuse' /dev/null if $? != 0; then echo $LINE noabuse.txt fi done iplist I'm getting command not found on the if line. Have I not formatted it correctly? The script is supposed to append

Re: [gentoo-user] OT - Question about conditionals and bash scripting

2006-10-12 Thread Michael Sullivan
On Thu, 2006-10-12 at 13:49 -0700, Richard Broersma Jr wrote: I have a short script: #!/bin/bash while read LINE do whois $LINE | grep 'abuse' /dev/null if $? != 0; then echo $LINE noabuse.txt fi done iplist I'm getting command not found on the if

Re: [gentoo-user] OT - Question about conditionals and bash scripting

2006-10-12 Thread Neil Bothwick
On Thu, 12 Oct 2006 15:41:12 -0500, Michael Sullivan wrote: while read LINE do whois $LINE | grep 'abuse' /dev/null if $? != 0; then echo $LINE noabuse.txt fi done iplist I'm getting command not found on the if line. The if line should be if [ $? -ne 0 ]; then Or you

Re: [gentoo-user] OT - Question about conditionals and bash scripting

2006-10-12 Thread Richard Broersma Jr
OK. Here's my new code: #!/bin/bash while read LINE do whois $LINE | grep 'abuse' /dev/null if [$? -ne 0]; then echo $LINE noabuse.txt fi done iplist Here's the output: [EMAIL PROTECTED] ~/.maildir/.SPAM/cur $ ./process.sh ./process.sh: line 6: [1: command

Re: [gentoo-user] OT - Question about conditionals and bash scripting

2006-10-12 Thread Brett I. Holcomb
Surround the [ and ] with spaces. On Thursday October 12 2006 17:08, Michael Sullivan wrote: On Thu, 2006-10-12 at 13:49 -0700, Richard Broersma Jr wrote: I have a short script: #!/bin/bash while read LINE do whois $LINE | grep 'abuse' /dev/null if $? != 0; then

Re: [gentoo-user] OT - Question about conditionals and bash scripting

2006-10-12 Thread Bo Ørsted Andresen
On Thursday 12 October 2006 23:08, Michael Sullivan wrote: [SNIP] OK. Here's my new code: [SNIP] Maybe you should have a look at: http://devmanual.gentoo.org/tools-reference/bash/index.html -- Bo Andresen pgpxpDTTnsL1r.pgp Description: PGP signature

Re: [gentoo-user] OT - Question about conditionals and bash scripting

2006-10-12 Thread alain . didierjean
Selon Michael Sullivan [EMAIL PROTECTED]: #!/bin/bash while read LINE do whois $LINE | grep 'abuse' /dev/null if [$? -ne 0]; then echo $LINE noabuse.txt fi done iplist Here's the output: [EMAIL PROTECTED] ~/.maildir/.SPAM/cur $ ./process.sh ./process.sh: line 6: