blob: 723af9ec79dce369d071f6988652c4d263528daf (
plain)
1
2
3
4
5
6
7
8
9
10
|
#!/bin/bash -eu
lines=$(who | grep pts | grep -Ev "\(:pts")
if [[ -z "$lines" ]]; then
printf '{"text":"No SSH connections", "tooltip":"No SSH connections", "class":"normal"}'
else
line_count=$(echo "$lines" | wc --lines)
lines="${lines/$'\n'/\\\\n}"
printf '{"text":"'"$line_count"' SSH connection(s)", "tooltip":"'"$lines"'", "class":"active"}'
fi
|