1
0
Fork 0
mirror of https://github.com/Horhik/dotfiles.git synced 2024-11-09 10:23:11 +00:00
Dotfiles/.config/polybar/themes/monolit-dracula/polybar-scripts/info-ssh-sessions/info-ssh-sessions.sh
2020-09-05 14:43:37 +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