#!/bin/bash cd "$(dirname "$0")/.." FILE=${1:-'/etc/shadow'} EXITSTATUS=0 while read entry; do login=$(echo $entry | cut -d: -f1) expiration=$(echo $entry | cut -d: -f8) if [ -z "$expiration" ]; then echo $login: does not have an expiration date let "EXITSTATUS++" fi done < "$FILE" exit $EXITSTATUS