The intention of my script is to print the users who have inactive days of more than 30. This is my script:
#!/bin/bash
max=30
grep -E ^[^:]+:[^\!*] /etc/shadow | awk -F: '{print $1" "$7}' | while read user days
do
if [ $days -gt $max ]
then
echo $user
echo $days
fi
done
I created 2 users, test and test2 each with 30 days and 50 days inactivity respectively. This script returns me both when I only need to print test2 with 50 days of inactivity.