Menu Driven Shell Script

Posted on in Categories Decision Making last updated April 5, 2008

Explains how to write a menu driven Shell script, which has following options:
1. Contents of /etc/passwd
2. List of users currently logged
3. Present handling directory (working directory)
4. Exit

Take action as per selected option

8 comment

  1. A tip: using ” read -n 1 opt” line instead of ” read opt” in the script, the user should not press after the number selection, the corresponding operation immediately starts.

  2. There are several programs that do this, but currently I can only find pdmenu and can not get it to function on CentOS. cursel is another on Freshmeat, but yum and apt say it dosen’t exist.

    pdmenu works Great! Thank you Joey Hess!
    Debian packages available.

  3. This script does not seem to be working, can you advise on the following error:

    syntax error near unexpected token ‘in’
    error on line 12

    P.S. I shortened the script a little, but basically its the line starting with case $opt in which seems to be broken?

    I am running Solaris 10, does this make a difference?

Leave a Comment