Добрый день!
помогите выровнять вывод по центру
#!/bin/bash
center()
{
IFS=""
while read L
do
printf "%b\n" $(printf "%.$((($(tput cols)-${#L})/2))d" 0 | sed 's/0/ /g')$L
done
}
SystemMountPoint="/";
LinesPrefix=" ";
b=$(tput bold); n=$(tput sgr0);
SystemLoad=$(cat /proc/loadavg | cut -d" " -f1);
ProcessesCount=$(cat /proc/loadavg | cut -d"/" -f2 | cut -d" " -f1);
MountPointInfo=$(/bin/df -Th $SystemMountPoint 2>/dev/null | tail -n 1);
MountPointFreeSpace=( \
$(echo $MountPointInfo | awk '{ print $6 }') \
$(echo $MountPointInfo | awk '{ print $3 }') \
);
UsersOnlineCount=$(users | wc -w);
UsedRAMsize=$(free | awk 'FNR == 3 {printf("%.0f", $3/($3+$4)*100);}');
localIPaddr=$(hostname -I);
if [ ! -z "${LinesPrefix}" ] && [ ! -z "${SystemLoad}" ]; then
systemload=$(echo -e "${LinesPrefix}${b}System load:${n}\t${SystemLoad}\t\t\t")
process=$(echo -e "$LinesPrefix${b}Processes:${n}\t${ProcessesCount}\t\t\t";)
fi;
if [ ! -z "${MountPointFreeSpace[0]}" ] && [ ! -z "${MountPointFreeSpace[1]}" ]; then
usegeof=$(echo -ne "${LinesPrefix}${b}Usage of $SystemMountPoint:${n}\t${MountPointFreeSpace[0]} of ${MountPointFreeSpace[1]}\t\t\t");
fi;
userslogged=$(echo -e "${LinesPrefix}${b}Users logged in:${n}\t${UsersOnlineCount}";)
if [ ! -z "${UsedRAMsize}" ]; then
#memoryusage=$(echo -ne "${LinesPrefix}${b}MEM usage:${n}\t${UsedRAMsize}%\t\t\t";)
memoryusage=$(echo -ne "Memory usage:${n}\t${UsedRAMsize}%";)
fi;
localip=$(echo -ne "${LinesPrefix}${b}Local IP address:${n}\t${localIPaddr}";)
printf "$systemload*$process\n$usegeof*$userslogged\n$memoryusage%*$localip" | column -t -s '*' | center
Вывод в таблице сдвинут, не могу выровнять