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

Re: Bash



 Hi.

On Fri, 14 Nov 2014 22:45:19 +0200
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"

Replace the telnet command with a netcat like this:

nc localhost 25 < /dev/null

And, btw, a correct spelling of shebang is

#!/bin/bash

Reco


Reply to: