[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bash



On Fri, Nov 14, 2014 at 3:45 PM, Gokan Atmaca <linux.gokan@gmail.com> wrote:
> I want to conditionally output from the bash command. for example
>
> telnet localhost 25
> 220 localhost.localdomain ESMTP Postfix
>
> #! / bin / bash
> COMMAND = `telnet localhost 25`
> if ["$ COMMAND" == "220 localhost.localdomain ESMTP Postfix"]
> echo "postfix ok"
> else
> echo "postfix error"
>

You might have better luck with netcat (nc).  Something like:

COMMAND=`nc localhost 25 | head -1l`

Eric


Reply to: