Created
June 27, 2018 22:27
-
-
Save jimlambie/6a2a6a89481e8e5b518d7c84caf7bfc5 to your computer and use it in GitHub Desktop.
This file contains 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
BASE_PORT=3001 | |
INCREMENT=1 | |
port=$BASE_PORT | |
isfree=$(netstat -taln | grep $port) | |
while [[ -n "$isfree" ]]; do | |
port=$[port+INCREMENT] | |
isfree=$(netstat -taln | grep $port) | |
done | |
echo "$port" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment