Crontab Script Confirmation
I have a quick question involving crontab and a script I want to run with it. The script generates and sends an email to group members who are on-call for a given day, but when you run it this appears
'Run This Script?'
The script will run when you enter 'y' or 'yes' and then press enter.
I'm trying to give that input via another script which runs the first one and then waits for the prompt to input a 'y'
How can I make a script which waits for a prompt and then gives it input? I'm stuck on this... and if there is a better way to do it please let me know.
Bash script? Perl script?
use the "expect" function in bash to wait for a reply.
That looks like exactly what I want.
To give you more information, the script that makes/sends the emails is in perl (which I don't know very well, and wasn't written by me), and the script calling the perl is in bash.
So if I use expect in the bash script after calling the perl script I should be able to get it to give the perl script the ok to continue?
I do have one last question.
If I am replacing my shell script with an expect script that I want to run the perl and then give the perl input it'd look something like this right?
spawn perl NAMEOFPERLSCRIPT.pl
expect "Run This Script?"
Sorry for all the questions, expect is a new tool to me.
Another option: if the answer is always "yes" you can try the yes command as in:
hmm... I like that second idea much better, and it should work because the answer always is yes.
|All times are GMT -5. The time now is 09:30 PM.|