feat: manage versions with asdf

This commit is contained in:
2021-06-22 13:05:12 +02:00
parent c7f0923ced
commit 221d8465c9
15 changed files with 124 additions and 95 deletions

View File

@ -2,28 +2,33 @@
function fp(){
PORT=$1;
for p in "$@"
do
if [ "$(which lsof)" = "lsof not found" ]; then
echo "lsof not installed"
else
PIDS="$(lsof -t -i:$PORT)"
AMOUNT=$(wc -w<<<$PIDS);
if [ $AMOUNT = 0 ]; then
echo "No processes use port $PORT";
PORT=$var;
if [ "$(which lsof)" = "lsof not found" ]; then
echo "lsof not installed"
else
PIDS="$(lsof -t -i:$PORT)"
echo "Killing $AMOUNT process(es) using port $PORT";
AMOUNT=$(wc -w<<<$PIDS);
echo "$PIDS" | while IFS= read -r pid ; do
kill -9 $pid;
done
if [ $AMOUNT = 0 ]; then
echo "No processes use port $PORT";
else
echo "Killing $AMOUNT process(es) using port $PORT";
echo "$PIDS" | while IFS= read -r pid ; do
kill -9 $pid;
done
fi
fi
fi
}
done
}