summaryrefslogtreecommitdiff
path: root/bin/missing-expiration-date
blob: d0caa287248d03a26f903140ddc2af03f679ff8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/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