ravagilli
May 12th, 2010, 07:53 PM
During the past 5-6 weeks I have been working in a new post as a trainee UNIX Systems Administrator. My manager has gained a lot of confidence in my work and has asked me to prepare a set of utilities for novice users which can all be run from a single menu interface.
Only one problem, i haven't really got any idea how to achieve the finished result!!! I've had a little go and what i've done so far is in the code box below. Any help would be greatly appreciated.
Stage 1 Must have the following functionality:
- Produce a script which displays menus.
- The menu must initiate commands in response to user input.
- The following commands should be implemented:
o List the current directory
o List the current users on the system
o List the current network settings
o Display the users current user name
Stage 2 Must have the functionality of stage 1 in addition to the following:
- The menu must loop repeatedly until the user chooses an option to quit
- The code must be divided into appropriately named functions which are called from the menu
- The following commands should be implemented:
o List the current directory in detailed format listing all permissions
o List the current network settings with all details displayed
o List all currently running processes
Stage 3 Must have the functionality of stages 1 and 2 in addition to the following:
- The menu must clear the screen before redisplaying itself
- Perform all the options listed in stage 2
- Give the option to create a zipped version of a directory. The user must be given the option to supply the name of the directory to be zipped and the name of the zipped file.
- Give the option to unzip a zipped file. The user must be given the option to supply the name of the zipped file and the directory for the contents to be extracted to.
#!/bin/bash
echo -n "Please select from the following:
A) List the current directory
B) List the current users on the system
C) List the current networking settings
D) Display the users current user name
:"
read ***
case $*** in
A) who ;;
B) who ;;
C) ifconfig ;;
D) whoami ;;
*)echo "Not in list:";;
esac
Only one problem, i haven't really got any idea how to achieve the finished result!!! I've had a little go and what i've done so far is in the code box below. Any help would be greatly appreciated.
Stage 1 Must have the following functionality:
- Produce a script which displays menus.
- The menu must initiate commands in response to user input.
- The following commands should be implemented:
o List the current directory
o List the current users on the system
o List the current network settings
o Display the users current user name
Stage 2 Must have the functionality of stage 1 in addition to the following:
- The menu must loop repeatedly until the user chooses an option to quit
- The code must be divided into appropriately named functions which are called from the menu
- The following commands should be implemented:
o List the current directory in detailed format listing all permissions
o List the current network settings with all details displayed
o List all currently running processes
Stage 3 Must have the functionality of stages 1 and 2 in addition to the following:
- The menu must clear the screen before redisplaying itself
- Perform all the options listed in stage 2
- Give the option to create a zipped version of a directory. The user must be given the option to supply the name of the directory to be zipped and the name of the zipped file.
- Give the option to unzip a zipped file. The user must be given the option to supply the name of the zipped file and the directory for the contents to be extracted to.
#!/bin/bash
echo -n "Please select from the following:
A) List the current directory
B) List the current users on the system
C) List the current networking settings
D) Display the users current user name
:"
read ***
case $*** in
A) who ;;
B) who ;;
C) ifconfig ;;
D) whoami ;;
*)echo "Not in list:";;
esac