Results 1 to 1 of 1

Thread: Put fixed answers instead of promt for user input

  1. #1
    Junior Member
    Join Date
    Jul 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default Put fixed answers instead of promt for user input

    I am trying to put answer bin in script
    after line
    ${PRINTF_CMD} "Enter an administrative group ( ${GROUP} ): "

    When running a complete script in terminal, it shows
    "Enter an administrative group ( bin ): "
    and prompts for user input.
    I want to automate this script by putting my fixed answers in this script.

    I have tried with below

    Code:
    command << EOF
    bin
    EOF
    after line of ${PRINTF_CMD} "Enter an administrative group ( ${GROUP} ): "
    but it doesnt work.

    Please help!




    PS. Complete part of script is (down):
    -------------------------------------------------------------------------------------------------
    Code:
    set_group() 
    {
        DEF_GROUP="`list_default_group`"
        if [ -z "${1}" ];then
            ${ECHO_CMD}
            ${ECHO_CMD} "This application is a suid root program, which allows the" 
            ${ECHO_CMD} "root user or members of the administrative group to have"
            ${ECHO_CMD} "administrative privileges. These privileges include adding,"
            ${ECHO_CMD} "removing, and modifying printer queues." 
            ${ECHO_CMD}
            ${ECHO_CMD} "To set the administrative group, select any valid group."
            ${ECHO_CMD} "The default is ( ${DEF_GROUP} )."
            ${ECHO_CMD}
    
            continue=yes
        
            app_group="`get_value app.group`"
            if [ "${?}" = "0" ];then
                GROUP="${app_group}"
            else
                GROUP="${DEF_GROUP}"
            fi
        
            while [ "${continue}" = "yes" ]
            do
                ${PRINTF_CMD} "Enter an administrative group ( ${GROUP} ): "
                read mvgroup
                if [ -z "${mvgroup}" ]; then
                    mvgroup="${GROUP}"
                fi
                check_group ${mvgroup}
                if [ "${?}" = "0" ];then
                    continue=no
                fi
            done
                    
        else
            mvgroup=${1}
            check_group ${mvgroup} 
            if [ "${?}" != "0" ];then
                setup_incomplete
                exit 1
            fi
        fi
    -------------------------------------------------------------------------------------------------
    Last edited by h.vujcec; 28th July 2008 at 08:57 PM. Reason: simple formating

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Linux / UNIX Interview questions and answers
    By shanthiavari in forum The Hangout
    Replies: 13
    Last Post: 29th June 2014, 04:18 PM
  2. Interpreting ~ from user input
    By al001 in forum Shell scripting
    Replies: 2
    Last Post: 21st April 2008, 09:27 PM
  3. Problem fixed
    By vivek in forum Feedback & Site News
    Replies: 0
    Last Post: 11th November 2005, 05:51 PM
  4. curses Problems with Non-Blocking input
    By kgmf in forum Coding in General
    Replies: 3
    Last Post: 1st April 2005, 02:49 PM
  5. Program gets aborted on large input
    By Ssk in forum Linux software
    Replies: 7
    Last Post: 14th March 2005, 12:04 PM

Tags for this Thread

Posting Permissions

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