Unix Blog

 
 
 
choice=0

while [ $choice -lt 4 ]
do
tput clear
echo \"1. contents of etc/passwd\"
echo \"2. list of the users who have logged in\"
echo \"3. Present working directory\"
echo \"4. Exit\"
echo \"Enter your choice \"
read choice

if [ $choice -eq 1 ]
then
        cat /etc/passwd | more
        read a
elif [ $choice -eq 2 ]
then
        who | more
        read a
elif [ $choice -eq 3 ]
then
        pwd
        read a
fi
done


-------------------------------------------------------------------
output
-------------------------------------------------------------------

1. contents of etc/passwd
2. list of the users who have logged in
3. Present working directory
4. Exit
Enter your choice
1
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
news:x:9:13:news:/etc/news:
uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
games:x:12:100:games:/usr/games:/sbin/nologin
gopher:x:13:30:gopher:/var/gopher:/sbin/nologin
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
nobody:x:99:99:Nobody:/:/sbin/nologin
rpm:x:37:37::/var/lib/rpm:/bin/bash
vcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologin
nscd:x:28:28:NSCD Daemon:/:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
rpc:x:32:32:Portmapper RPC user:/:/sbin/nologin
rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin


1. contents of etc/passwd
2. list of the users who have logged in
3. Present working directory
4. Exit
Enter your choice
2
mca258   pts/0        Nov 19 12:28 (128.66.203.10)


1. contents of etc/passwd
2. list of the users who have logged in
3. Present working directory
4. Exit
Enter your choice
3
/home/symca/mca258
----------------------------------------------------------------------

    Related Post:
  1. Display your login name

  2. Program to calculate the area and perimeter of the rectangle

  3. Write a Script to Broadcast a message to a specified user when the user loged on any terminal

  4. Create a file with 10 lines. Display lines from 5 to 8

  5. Program to convert and print this distance in meters, feet, inches and centimeters

  6. Shell Script to create a Menu Driven program : Hard Link, Soft Link, Counting each of the links for a specific link and Display the soft-links

  7. Shell Script to delete the zero sized file using if and for

  8. Write a shell scripts that finds total no. of users and finds out how many of them are currently loggedin

  9. Write a shell script, which reports names and sizes of all files in a directory whose size is exceeding 1000 bytes

  10. Write a shell program to concatenate the contents of 2 files

  11. Write a shell program to count number of words, characters,white spaces and special symbols in a givin text

  12. Print message a shown in description

  13. Give example of cut command?

  14. Write a shell script to find the largest among the 3 given numbers

  15. Shell Script to make a menu driven calculator using case

  16. Write a shell script to search all files and rename them such that they do not contain the shell PID.

  17. Write a shell program to find the position of substring in given string

  18. write a script to delete zero sized files from a given directory (and all its subdirectories)

  19. Shell script to perform string replacement in a file and view the content of file

  20. Write a shell script to reverse a number supplied by a user