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
Post a Comment