I need to convert script:
s#!/bin/bash
if [ $# -ne 1 ]; then
echo "Usage:"
echo ${0##*/}" <port>"
echo
exit 1
fi
r=`ss -ln6tp | grep -c ":::$1"`
if [ $r -ne 1 ]; then
echo "Agent on port $1 is not listening."
exit_code=2
else
echo "Agent listening on port $1"
exit_code=0
fi
exit $exit_code
I don't have experience with bash at all and my powershell knowledge is basic. Exit code is the main problem for me here. Any ideas please?