In this example below, I need to check if the port 22 (SSH) is opened.
#!/bin/sh
if nc -w 3 localhost 22 <<< ” &> /dev/null
then
echo ‘Port is open’
else
echo ‘Port is closed’
fi
welcome..
In this example below, I need to check if the port 22 (SSH) is opened.
#!/bin/sh
if nc -w 3 localhost 22 <<< ” &> /dev/null
then
echo ‘Port is open’
else
echo ‘Port is closed’
fi