I'm using the following code to find the duplicate username. However, it gives an error.
#!/bin/bash
cat /etc/passwd | cut -f1 -d":" | /bin/sort -n | /usr/bin/uniq -c |\
while read x; do [ -z "${x}" ] && break set - $x
if [ $1 -gt 1 ]; then
uids=`/bin/gawk -F: '($1 == n) { print $3 }' n=$2 \
/etc/passwd | xargs`
echo "Duplicate User Name ($2): ${uids}"
fi
done
I'm facing a syntax error near the token 'done' and numeric error. How can I fix this error?