Menu driven Program using case coderinme

Menu driven Program using case coderinme

Menu driven Program in which
use 1 2 3 4 as follows
1>content of /etc/passwd
2>login user
3> current directory 4>exit
using Case in shell script
It’s very easy because we know that /etc/passwd contains the detail of user group and their details and
you can read more about /etc/passwd
else same as login user name.
For present working directory so we use pwd so let’s code

#!/bin/bash
(bash copy)
tput clear
tput bold
tput cup 7 15; echo "1. Contents of /etc/passwd and"
tput cup 8 15; echo "2. Lists of users who have currently logged in else "
tput cup 9 15; echo "3. Present working directory"
tput cup 10 15; echo "4. Exit"
tput sgr0
tput cup 12 15
read -p "Enter your choice [1-4] " choice
tput cup 15 0
case $choice in
1 ) cat "/etc/passwd";;
2 ) who;;
3 ) pwd;;
4 )
tput clear
tput sgr0
tput rc
clear
;;
esac

If you want to see Linux questiom

All rights reserved. No part of this Post may be copied, distributed, or transmitted in any form or by any means, without the prior written permission of the website admin, except in the case of brief quotations embodied in critical reviews and certain other noncommercial uses permitted by copyright law. For permission requests, write to the owner, addressed “Attention: Permissions Coordinator,” to the admin @coderinme

A web developer(Front end and Back end), and DBA at csdamu.com. Currently working as Salesforce Developer @ Tech Matrix IT Consulting Private Limited. Check me @about.me/s.saifi

Leave a reply:

Your email address will not be published.