Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

In linux, how can I find the max and min user ids in /etc/passwd using a script?

#!/bin/bash
l=$(grep "^UID_MIN" /etc/passwd)
l1=$(grep "^UID_MAX" /etc/passwd)
awk -F':' -v "min=${l##UID_MIN}" -v "max=${1##UID_MAX}" '{ if ( $3 >= min && $3 
<= max 
) print $0}' /etc/passwd

Comments