UNIX shell script that when executed gives you the actual count of regular and special users on the system | UNIX shell script

Problem

Write a UNIX shell script that when executed gives you the actual count of regular and special users on the system.

#!/bin/bash
cat /etc/passwd | cut -d':' -f3 1> total_user.txt
sp_user=0
reg_user=0

while read nxt_line
do
         if [ $nxt_line -ge 500 -a $nxt_line -le 60000 ]
         then
                reg_user=`expr $reg_user + 1`
         elif [ $nxt_line -eq 0 ]
         then
                sp_user=`expr $sp_user + 1`
         fi
done < total_user.txt

echo "total number of special users are: $sp_user"
echo "total number of regular users are: $reg_user"

Comments

Popular posts from this blog

Assembly Program Code For Brick Breaker Game

The Untold Story: U.S. Special Forces' Bold Pursuit of Adolf Hitler