Telnet errors coming on screen while using snarf command.

Hi Team,

I am using one script, It is working fine, the problem is it gives unwanted telnet errors when I am using it.
I just want to remove these unwanted errors/info from my screen.

bash-3.00$ cat raza_site_temp
#!/usr/bin/bash
#rj835b
IFS="|"
REGEX="$*"
echo
snarf2 -c "show chassis status" `showHosts gsx |egrep "$REGEX"` > /dev/null > d1d1
echo
cat d1d1 |egrep -i "Node|Temp"|sed '/Node/{x;p;x;}'
echo
echo
echo "GSX Temperature > 30C"
echo "*********************"
echo
cat d1d1|egrep "Node|Temp"|awk '{if ($1~/Node:/) print $1,$2; else if ($1~/Temperature/) print $0}'|sed '$!N;s/\n/ /'|awk '{if (substr($4,1,2)>30) print $2,"----->", $4}'|awk '{printf "%-10s %s %s\n", $1,$2,$3}'
echo
bash-3.00$

Output of the script

bash-3.00$ ./raza_site_temp hst

Enter GSX Login: Enter GSX Password: 
telnet: Unable to connect to remote host: Connection refused
Connection to 10.24.63.67 closed by foreign host.
Connection to 10.24.63.68 closed by foreign host.
telnet: Unable to connect to remote host: Connection refused
Connection to 10.24.63.70 closed by foreign host.
telnet: Unable to connect to remote host: Connection refused
Connection to 10.24.63.72 closed by foreign host.
telnet: Unable to connect to remote host: Connection refused
Connection to 10.24.63.74 closed by foreign host.
telnet: Unable to connect to remote host: Connection refused
Connection to 10.24.63.98 closed by foreign host.
telnet: Unable to connect to remote host: Connection refused


Node: hstg1so                                  Date: 2013/08/20 09:35:31  GMT
Temperature:   25C

Node: hstg2so                                  Date: 2013/08/20 09:35:39  GMT
Temperature:   26C

Node: hstg3so                                  Date: 2013/08/20 09:35:48  GMT
Temperature:   24C

Node: hstg4so                                  Date: 2013/08/20 09:35:55  GMT
Temperature:   25C

Node: hstg5so                                  Date: 2013/08/20 09:36:03  GMT
Temperature:   25C

Node: hstg6so                                  Date: 2013/08/20 09:36:11  GMT
Temperature:   25C


GSX Temperature > 30C
*********************


bash-3.00$

When I fire script it will ask for password, then it will fetch data from different node, error coming from redundant ports.
I jus want these telnet and connection refused error does not appear on my screen.

Thanks
Raza

[s]You need to redirect STDERR to /dev/null as well to avoid these messages (unless inability to contact a host is of interest :wink: ), we can do this by redirecting stderr to stdout 2>&1 this is a very common idiom.

snarf2 -c "show chassis status" `showHosts gsx |egrep "$REGEX"` > /dev/null > d1d1 2>&1
```[/s]


Duplicate thread... answered on the better formatted one.