From 8850bfa301f8313d58d1238c3ee6af7d62d87548 Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 6 Dec 2022 23:45:15 +0100 Subject: [PATCH] leading space was breaking --- 12345.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/12345.sh b/12345.sh index caa38e57..4b428652 100755 --- a/12345.sh +++ b/12345.sh @@ -73,7 +73,7 @@ while true; do ## RANDOM PORT SWAPPINESS AVOIDING COLLISION ## CHECK PORT IS FREE & KILL OLD ONE - pidportinuse=$(ps axf --sort=+utime | grep -w "nc -l -p ${PORT}" | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) + pidportinuse=$(ps axf --sort=+utime | grep -w "nc -l -p ${PORT}" | grep -v -E 'color=auto|grep' | awk '{gsub(/^ +| +$/,"")} {print $0}' | tail -n 1 | cut -d " " -f 1) [[ $pidportinuse ]] && kill -9 $pidportinuse && echo "KILLING $pidportinuse" && continue ## CHECK 12345 PORT RUNNING (STATION FoF MAP)