Automate Script ***V. Urgent

Hi All,

./procdure.ksh which opens the below the menu, I want to build a script which will press 4 and run the Sector Data Automatically (instead of pressing option 4 manually)

Is there any way for this, please let me know...

1) FX Rates MDU 9) Fidessa Cash Equities
2) FX Rates DMDS 10) Fidessa Rest of World Orders
3) Market Data 11) Restricted List
4) Sector Data 12) Hong Kong GL Feed
5) Paris Cash Equities 13) Research Feed
6) Paris Derivatives 14) MDU FI Feed
7) London Derivatives 15) FI BBLink Trade
8) Fidessa Books 16) Return
Select one of the Above Procedure Groups: 4

echo -e "\n\n \t\t\tPLEASE SELECT THE OPTION"
echo -e "\n\n\t\t\t\t1. first option"
echo -e "\n\n\t\t\t\t2. second option "
echo -e "\n\n\t\t\t\t3. Third optoin "
echo -e "\n\n\t\t\t\t4. Fourth option"
echo -e "\n\n\t\t YOUR OPTION ::"

select=$@

#OR either you can parse argument with option which you want to #run in your menu or directly you can give the option as hard code #inside your sciript

select=1

case $select in
1) echo "first one"
;;
2) echo "second one"
;;
3) echo "third one"
;;
4) echo "fourth one"
;;
esac

Thanks
Sha

actually i want alaways option 4 to run,

but thorough some script which read menu first ./procdure.ksh 4 (option)

want to autmate this...

Note:- I hv to embed this code in my other big script

Thanks

Now i have included condition ..so this code can directly implement in your script..

should work..

echo -e "\n\n \t\t\tPLEASE SELECT THE OPTION"
echo -e "\n\n\t\t\t\t1. first option"
echo -e "\n\n\t\t\t\t2. second option "
echo -e "\n\n\t\t\t\t3. Third optoin "
echo -e "\n\n\t\t\t\t4. Fourth option"
echo -e "\n\n\t\t YOUR OPTION ::"

select=$@

if [ -z $select ]
then
echo "enter the option to proceed further"
read select
fi

case $select in
1) echo "first one"
;;
2) echo "second one"
;;
3) echo "third one"
;;
4) echo "fourth one"
;;
esac

Thanks
Sha

you could use expect

Expect - Expect - Home Page

./procdure.ksh seems to be a script you own, written to manage your environment. Edit the script and add the ability to pass the menu option as command line argument 1. This will come a useful option, when you find other menu items you wish to execute without having to manually select from the menu.

this is very cool, i did not know you could do this - i wish ksh had this functionality

the suffix .ksh indicates that it is a KORN shell script. The select line "Select one of the Above Procedure Groups: " is going to be found at the end of a case statement of IF,ELIF,FI statement. In the script set a variable ARG1="$1" for the command line. Then before the case or IF statement add an IF statement
if [[ -n $ARG1 ]]; then
<variable in case statement>=$ARG1
else
<orig case statement goes here>
fi