Find the answer to your Linux question:
Results 1 to 8 of 8
how would i script in menus? like get in the script and have a multiple choice press 1 for this and 2 for that kinda thing?...
  1. #1
    Just Joined!
    Join Date
    Nov 2006
    Posts
    90

    scripting menus

    how would i script in menus? like get in the script and have a multiple choice press 1 for this and 2 for that kinda thing?

  2. #2
    Linux User
    Join Date
    Aug 2006
    Posts
    458
    Quote Originally Posted by jwmw1023 View Post
    how would i script in menus? like get in the script and have a multiple choice press 1 for this and 2 for that kinda thing?
    you should get to know these :
    1) read
    2) while /for loops
    3) if/test conditionals
    4) echo/printf
    5) sed/awk ?
    etc
    but first, pls check this out

  3. #3
    drl
    drl is offline
    Linux Engineer drl's Avatar
    Join Date
    Apr 2006
    Location
    Saint Paul, MN, USA / CentOS, Debian, Solaris, SuSE
    Posts
    1,117
    Hi.

    If you learn better from examples, then in the last link there are two sections that may be of interest:
    http://www.tldp.org/LDP/abs/html/testbranch.html#EX30
    and
    http://www.tldp.org/LDP/abs/html/testbranch.html#EX31
    Note that you may need some of the other links posted to understand the code ... cheers, drl
    Welcome - get the most out of the forum by reading forum basics and guidelines: click here.
    90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
    We look forward to helping you with the challenge of the other 10%.
    ( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )

  4. #4
    Just Joined!
    Join Date
    Nov 2006
    Posts
    90
    thanks! that worked! ok, one more thing, is there a command to mount all non-mounted hdd's all @ once?

  5. #5
    Just Joined!
    Join Date
    Nov 2006
    Posts
    90
    oh and if i want to find a file and execute it, like find an update file and use it, but im not sure what drive it may be on.and if i want the menu to complete commands but go back to the menu without exiting. im new at this and only have internet at work and i cant do much reading here

  6. #6
    Linux Engineer Freston's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    1,047
    Quote Originally Posted by jwmw1023
    is there a command to mount all non-mounted hdd's all @ once?
    man mount will do the trick

    Quote Originally Posted by jwmw1023
    oh and if i want to find a file and execute it, like find an update file and use it, but im not sure what drive it may be on.
    Drive? What's a drive?

    Maybe the find command will do this for you. If you have no idea where your file is, just search the whole system with:

    Code:
    find / -name file -print
    Quote Originally Posted by jwmw1023
    and if i want the menu to complete commands but go back to the menu without exiting.
    If you're writing menu's just keep this basic format:
    Code:
    while true; do
    clear
    echo $FEEDBACK
    echo "1. Option 1"
    echo "2. Option 2"
    echo "exit"
    echo
    echo -n "I'm waiting for instructions, my Master "
    read INSTR
    
    case $INSTR in
    	1)
    	FEEDBACK="You chose 1"
    	;;
    	2)
    	FEEDBACK="You chose 2"
    	;;
    	exit)
    	exit
    	;;
    	*)
    	FEEDBACK="Invalid option"
            ;;
    esac
    done

  7. #7
    Just Joined!
    Join Date
    Nov 2006
    Posts
    90
    ok what if i need to find and then execute something automagically? i need to have my updated scripts on a flash dr that can be automagically found and used on multiple machines on which the dr designation may move. the script needs to hunt it out by filename and use it. I PROMISE ILL LEAVE U GUYS ALONE WHEN I GET INTERNET @ MY HOUSE IN @ WEEKS!!!

  8. #8
    Just Joined!
    Join Date
    Nov 2006
    Posts
    90
    and what if i need press any key to continue functionality? sleep doesnt seem to do this

    edit: nevermind read -n 1 foo seems to work (i have no idea what it means, i just found it)

Posting Permissions

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