Last active
August 14, 2021 09:18
-
-
Save prochor666/36358eb4a3b53cd67bd0c6e8bae059d9 to your computer and use it in GitHub Desktop.
Check port usage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# @author [email protected] | |
# | |
# Check port usage | |
function inUse() | |
{ | |
if [[ -z $(ss -tulwn | grep -E "LISTEN.*:${@} ") ]]; | |
then | |
echo "SUCCESS: ${@} is free to use" | |
else | |
echo "ERROR: ${@} is used" | |
fi | |
} | |
echo "Check port usage" | |
echo "" | |
read -p "Input port: " PORT | |
inUse $PORT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment