#!/bin/bash
### Function to clearly list directories in PATH
showPATH() {
oldifs="$IFS" ### store old internal field separator
IFS=: ### specify a new internal field separator
for DIR in $PATH<br> do<br> echo $DIR<br> done
IFS="$oldifs" ### restore old internal field separator
}
### Function to show logged user
showUSERS() {
echo -e “Below are the user logged on the system:\n”
w
}
### Print a user’s details
printUSERDETS() {
oldifs="$IFS" ### store old internal field separator
IFS=: ### specify a new internal field separator
read -p "Enter user name to be searched:" uname ### read username
echo ""
### read and store from a here string values into variables
### using : as a field delimiter
read -r username pass uid gid comments homedir shell <<< "$(cat /etc/passwd | grep "^$uname")"
### print out captured values
echo -e "Username is : $username\n"
echo -e "User&#x27;s ID : $uid\n"
echo -e "User&#x27;s GID : $gid\n"
echo -e "User&#x27;s Comments : $comments\n"
echo -e "User&#x27;s Home Dir : $homedir\n"
echo -e "User&#x27;s Shell : $shell\n"
IFS="$oldifs" ### store old internal field separator
}