Operating System - HP-UX
1832800 Members
2766 Online
110045 Solutions
New Discussion

Re: Automate Manual Acceptance

 
panchpan
Regular Advisor

Automate Manual Acceptance

Hello.
At present in my UX shell script , I have few acceptance done manually. Could you please suggest the way I could make them automatic? Scenarios are :->

1) You are about to run Day Process. Continue (yes/no)?
2) Please enter a UID and PWD for Day Process :
User ID -
Password -
3) Confirm to continue (Y/N):

Below are the piece of script I am using:

1)
echo "\nYou are about to run Day Process. Continue (yes/no)? \c"
read ans
case "$ans" in
[Yy]*)
break
;;
*)
exit 0
;;
esac

2)
echo "\n\nEnter UserId for Day Process : \c "
read UID
echo "-U $UID" >> day.pf

stty -echo
echo "\nEnter Password for Day Process : \c "
read PWD
echo "-P $PWD" >> day.pf
stty echo


Please advice the modified commands?
Thank you!
5 REPLIES 5
Patrick Wallek
Honored Contributor

Re: Automate Manual Acceptance

The scripting language called 'expect' is designed for exactly this purpose.

You can get expect from:
http://hpux.connect.org.uk/hppd/hpux/Tcl/expect-5.43/
(Be sure to note the run time dependency of tcl/tk.)
panchpan
Regular Advisor

Re: Automate Manual Acceptance

Thank you - expect looks to be good... had never heard about it, shall learn about this. Isnt there any other way to automate it .. i mean, learning expect and installation might take lotta time.
D Block 2
Respected Contributor

Re: Automate Manual Acceptance

So you append to day.pf (file). I assume you reset this file after you process it ? You might also save this file somewhere ?

You might add the following code to prevent others from reading the file?

chmod 400 day.pf

what is your umask ? 002 ?

just thinking you do not want others to read the $PWD and $UID found in this day.pf (file).

Golf is a Good Walk Spoiled, Mark Twain.
panchpan
Regular Advisor

Re: Automate Manual Acceptance

Hello.
i am trying to remove or automate these 'read' commands from script. please advice if could there be a way?

Thank you
Dennis Handly
Acclaimed Contributor

Re: Automate Manual Acceptance

>i am trying to remove or automate these 'read' commands from script. please advice if could there be a way?

Well, where do you expect to get the info?
You could squirrel it away in a . file.
Or you could use the LOGNAME for UID, if they mean the same to you.