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 > > > 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 if the > > > return code of whois $LINE | grep 'abuse' returns false (not 0)... > > > > Do you need to add > > if test... > > or if [ ... ]? > > > > Regards, > > > > 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 not found > ./process.sh: line 6: [1: command not found > ./process.sh: line 6: [1: command not found > Interrupted by signal 2...
-- Brett I. Holcomb -- gentoo-user@gentoo.org mailing list