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} ): " ...
|
|||||||
| Register | FAQ | Members List | Calendar | Forgotten your password? | Mark Forums Read |
|
|||
|
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 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 |
| Sponsored Links | ||
|
|
![]() |
| 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 | |
|
|
|
||||
| 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 |