I have to set in crontab an sh script that prompts user to answer before executing. But sometimes the question needs "Yes" or "No" answer and sometimes the same script waits for "Force" or "Abort". I can't modify this script, so i need to make my script to launch the first one, catch the prompt output text and check the prompt text to answer "Yes" or "Force" automatically. I've tested something like this but doesn't work :
if command.sh | grep 'Force' =0
then echo "Force"
else echo "Yes"
fi
Thank you for your advices or help :)