Script to automation utility app

Hi All,

Am trying to write a shell script to automate one of the product utility but am struck with how to send/key in the inputs and most importantly it requires to press "Enter" key every time after giving the input.

Not sure how to take control of utility from script and key in values/command.

Can anyone please suggest or show the example on how automate the utility thru shell script.

ex: how utility is work manually.

./testItem

it opens screen with key in the input/command

once input is typed/key in then we need to press "Enter" Key

then we get relevant key in's output

I need to capture this output in some variable and verify the results later in main shell script.

Thanks,
Ops

Hi Optimus;

Here is a code snippet that should help;

echo -n "Please input the duration of the run in whole hours:- "
read durn

###############################################################################
#
# Check that the duration is not to long, truncate if it is.
#
###############################################################################

if [ ${durn} -gt 12 ]
        then
        echo ""
        echo "You have selected ${durn} hours which is too long for the test to run."
        echo ""
        echo "Test duration has been trucated to 12 hours."
        durn=12
        export durn
fi

Regards

Gull04