dot_config/private_fish/functions/random_free_port.fish 🔗
@@ -0,0 +1,7 @@
+function random_free_port --description 'Print a random unprivileged port not currently in use'
+ set -l p (shuf -i 1024-65535 -n 1)
+ while ss -tuln | string match -qr ":$p\$"
+ set p (shuf -i 1024-65535 -n 1)
+ end
+ echo $p
+end