Help needed on If Else

view story

http://www.unix.com – Hi, I am using "nc" command to test connectivity to Application ports. I am getting following outputs in case of success & failed scenarios & I am re-directing it to a file. Code: FLPROVP02 [] 4848 (?) open FLPROVP02 [] 4849 (?) : Connection refused My script is as below. Code: #!/bin/bash cd /root/nc_test/ nc -zv 4849 2> /root/nc_test/logfile2 I need help to write a If Else code that will help me to display "Port opened" & "Port cannot be reached" messages for the above 2 results. Thanks, Su (HowTos)