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: [1: command not found
> ./process.sh: line 6: [1: command not found
> ./process.sh: line 6: [1: command not found
> Interrupted by signal 2...
>

[ ... ] is a command, equivalent to test. So it has to be followed by an IFS,
usually a <space>. Try
   if [ $? -ne 0 ]; then
See the spaces between [ and $?, 0 and ]. It should work now. Once it done, read
some good doc about bash programming. It's very powerful but the syntax may seem
weird in a few cases.
Happy bash programming !

-- 
gentoo-user@gentoo.org mailing list

Reply via email to