ctw6av
(usa Nenhuma)
Enviado em 10/10/2016 - 20:50h
é só usar o expand com a opção -t para concertar tudo, teste ai:
#!/bin/sh
lsusers="/tmp/users"
echo $$ > /tmp/pid
if [ ! -f "$lsusers" ]
then
awk -F : '$3 >= 500 { print $1 "" }' /etc/passwd | grep -v '^nobody' > /tmp/users
fi
while true; do
echo -e "\tSSH Monitor"
tput setaf 6; echo -e "\nUsuário\tNº de Conexões\n" | expand -t 20 ; tput sgr0
while read lnusers
do
user="$(echo $lnusers | cut -d' ' -f1)"
ps x | grep $user | grep -v grep | grep -v pts > /tmp/tmp.tmp
conexoes="$(cat /tmp/tmp.tmp | wc -l)"
echo -e "$user\t$conexoes" | expand -t 19
awk -F : '$3 >= 500 { print $1 "" }' /etc/passwd | grep -v '^nobody' > /tmp/users
done < "$lsusers"
echo " "
exit 1
done
______________________________________________________________________
OS: Kali Linux kali-rolling kali-rolling
Kernel: x86_64 Linux 4.6.0-kali1-amd64
Resolution: 2390x768
CPU: Intel Core i3-4005U CPU @ 1.7GHz
RAM: 3852MiB