Find the answer to your Linux question:
Results 1 to 3 of 3

Thread: menu script

Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    menu script

    Hello everybody. I'm pretty new with Linux and the bash shell. I have to make a menu and well... that part went fine. What I am having trouble with is the case at the bottom. When I input a letter it doesn't do anything. I created 4 executable scripts and gave everybody execute permission. They are mostly just cut and sort. Any input would be appreciated. Now its just a menu. That right there is the problem i think.

    #[Ll]) ./empappL ;;
    #[Ff]) ./empappF ;;
    #[Cc]) ./empappC ;;
    #[Ss]) ./empappS ;;
    #[Qq]) ./exit ;;

    Oh and also. They are in the same directory as the file that is being manipulated and the menu

    while [ "$loop" = y ]
    tput cup 3 12; echo "Employee Information Menu"
    tput cup 4 12; echo "========================="
    tput cup 6 9; echo "L - Print Last Names"
    tput cup 7 9; echo "F - Print First Names"
    tput cup 8 9; echo "C - Print Last Name sorted by city"
    tput cup 9 9; echo "S - Print First Name, Last Name, State sorted by state"
    tput cup 10 9; echo "Q - Exit the program"

    read choice || continue
    case $choice in
    [Ll]) ./empappL ;;
    [Ff]) ./empappF ;;
    [Cc]) ./empappC ;;
    [Ss]) ./empappS ;;
    [Qq]) ./exit ;;
    *) tput cup 14 4; echo "Invalid Code"; read choice ;;

  2. #2
    Linux Engineer hazel's Avatar
    Join Date
    May 2004
    Harrow, UK
    Do you actually have a script called exit in this directory? If not, and you want to use bash's built-in exit function, you need to write "exit", not "./exit".
    "I'm just a little old lady; don't try to dazzle me with jargon!"

  3. #3
    Are you sure the scripts being called are not running? Put a sleep after the call to each script to see the output. Or log the output to a file. Also, you can probably exit after running the scripts, b/c right now, it just loops back to the menu (unless that's what you want). e.g.:

    [Ll]) ./empappL;sleep 5;exit;
    [Ff]) ./empappF > /tmp/empappF.log 2>&1;exit ;;
    [Cc]) ./empappC && echo success || echo failure;exit ;;
    [Ss]) ./empappS;exit ;;

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts