diff options
| author | mo khan <mo.khan@gmail.com> | 2019-10-14 10:35:45 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2019-10-14 10:35:45 -0600 |
| commit | f12ef3fd3851bb69aa2fbadd713ccff3298b7fab (patch) | |
| tree | d70ad5378717ba288aea01a71fe1d32084eeecae /bin | |
| parent | d32e87b86f6ddad2c2e427718bc9f480e0905055 (diff) | |
Create script for detecting duplicate login names
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/duplicate-login-names | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/bin/duplicate-login-names b/bin/duplicate-login-names new file mode 100755 index 0000000..af575f3 --- /dev/null +++ b/bin/duplicate-login-names @@ -0,0 +1,13 @@ +#!/bin/bash + +cd "$(dirname "$0")/.." +FILE=${1:-'/etc/passwd'} + +DUPLICATES=$(grep -v -E '^#' "$FILE" | awk -F: '{ print $1 }' | sort | uniq -d) +echo $DUPLICATES + +if [ -z "$DUPLICATES" ]; then + exit 0 +else + exit 1 +fi |
