Created
April 24, 2015 10:50
-
-
Save Voronenko/8ccd3226af34a447e4ec to your computer and use it in GitHub Desktop.
Find first unused port above ...
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 | |
ss -tln | | |
awk 'NR > 1{gsub(/.*:/,"",$4); print $4}' | | |
sort -un | | |
awk -v n=3000 '$0 < n {next}; $0 == n {n++; next}; {exit}; END {print n} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment