Using bash I am trying to query /etc/passwd for any users with an id over 1000.  If they exist do something, else do something else.  I'm stumped. Any help is appreciated.if [ $(id -u) -gt 1000 </etc/passwd]; then    do somethingelse    do something elsefi
if statement query user id in etc/passwd?
bash;text processing;users;etc;passwd
Try this:if grep -E '^[^:]*:[^:]*:[^:]{4}' /etc/passwd | grep -Evq '^[^:]*:[^:]*:1000:'The first grep searches passwd for lines with a uid of four or moredigits. The second grep filters out the line with uid 1000. The exitstatus will be 0 if any lines remain, 1 if not.