nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

Put fixed answers instead of promt for user input

This is a discussion on Put fixed answers instead of promt for user input within the Shell scripting forums, part of the Development/Scripting category; I am trying to put answer bin in script after line ${PRINTF_CMD} "Enter an administrative group ( ${GROUP} ): " ...


Go Back   nixCraft Linux Forum > Development/Scripting > Shell scripting

Register FAQ Members List Calendar Forgotten your password? Mark Forums Read
  #1 (permalink)  
Old 07-28-2008, 08:52 PM
Junior Member
User
 
Join Date: Jul 2008
My distro: CentOS
Posts: 1
Rep Power: 0
h.vujcec is on a distinguished road
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; 07-28-2008 at 08:57 PM.. Reason: simple formating
Reply With Quote
Sponsored Links
Reply

Bookmarks

Tags
automate shell script , automate user input , printf_cmd


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Linux / UNIX Interview questions and answers shanthiavari The Hangout 5 06-27-2008 09:47 AM
Interpreting ~ from user input al001 Shell scripting 2 04-21-2008 09:27 PM
Problem fixed vivek Feedback & Site News 0 11-11-2005 05:51 PM
curses Problems with Non-Blocking input kgmf Coding in General 3 04-01-2005 02:49 PM
Program gets aborted on large input Ssk Linux software 7 03-14-2005 12:04 PM


All times are GMT +5.5. The time now is 02:24 AM.


Powered by vBulletin® Version 3.7.4 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36