2023-11-02 22:16:35 +01:00
|
|
|
#!/bin/sh
|
|
|
|
for i in $@
|
|
|
|
do
|
2023-11-05 12:58:38 +01:00
|
|
|
RES="$(ps -x -o "comm vsz" | grep -Ei "^$i ")"
|
2023-11-02 22:16:35 +01:00
|
|
|
if [ ! -z "$RES" ]
|
|
|
|
then
|
|
|
|
echo "$RES" | xargs -n2 -I{} echo "Adding: {} KB"
|
2023-11-05 12:58:38 +01:00
|
|
|
TOTAL=$(( TOTAL + $(echo "$RES" | awk '{ sum=sum+$2; } END { printf("%d", sum); }') ))
|
2023-11-02 22:16:35 +01:00
|
|
|
else
|
|
|
|
echo "$@ not found."
|
|
|
|
fi
|
|
|
|
done
|
2023-11-05 12:58:38 +01:00
|
|
|
echo $TOTAL | awk '{ printf("Summary: %.2f MB\n", $1/1024); }'
|