Hi all - newbie here and my first post - yay!
I am literally bashing (pun intended) my head against the keyboard at this minute!
I am trying to automate a script via cron for my centos server. The script requires two user inputs (e.g. read VAR). However, I do not want to edit the original file, as I would like to be able to run it normally as well. It is also made by someone else, and so if an update becomes available, it will be easier to install.
So... My idea is that i create a cron script, to run this second script from, and the only way i could find was with expect.
However I am having troubles, In order to test out expect, I have created the following:
/usr/bin/expect - << EOD
# Comments on this script (name, what it does,
echo "Name & Favourites Routine ..."
echo "What is your name?"
echo "Your answer: $ANSWER"
echo "What do you like?"
echo "You love to: $LIKE"
But when i run "./test.sh" from the command line, I receive the following:
User@MacBook ~: ./include.sh
Name & Favourites Routine ...
What is your name?
Your answer: Me
What do you like?
It looks as if the second input is completely ignored ?!!
Can anyone help with what i am doing wrong? or if there is a more elegant solution to running a script from a script with user inputs?