1
0
Fork 0
mirror of https://github.com/Horhik/dotfiles.git synced 2024-09-18 21:47:51 +00:00
Dotfiles/.config/polybar/polybar-scripts/info-ssh-sessions/info-ssh-sessions.sh
2020-07-27 07:59:00 +03:00

11 lines
248 B
Bash

#!/bin/sh
sessions="$(lsof -Pi | grep ":22")"
if [ -n "$sessions" ]; then
count=$(echo "$sessions" | wc -l)
echo "# ($count): $(echo "$sessions" | cut -d ">" -f 2 | cut -d " " -f 1 | cut -d ":" -f 1 | tail -n 1)"
else
echo "# (0)"
fi