Last active
May 28, 2019 10:08
-
-
Save jeremyfix/7a8cb509af0f21c9038256b45331e912 to your computer and use it in GitHub Desktop.
Get a free port in a Makefile
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
#!/bin/bash | |
# Provided by https://superuser.com/a/1293762/622572 | |
comm -23 <(seq 10000 65535) <(ss -tan | awk '{print $4}' | cut -d':' -f2 | grep "[0-9]\{1,5\}" | sort | uniq) | shuf | head -n 1 |
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
$(eval PORT = $(shell ./get_free_port.sh)) | |
testbidule: | |
@echo "I found a free port number : " $(PORT) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment