1
0
Fork 0
mirror of https://github.com/Horhik/dotfiles.git synced 2024-12-03 20:06:37 +00:00
Dotfiles/.config/polybar/polybar-scripts/info-ssh-sessions/info-ssh-sessions.sh

11 lines
248 B
Bash
Raw Normal View History

2020-07-27 04:59:00 +00:00
#!/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