I am new to Unix and not sure how to use crontab. I want to write a program that will update a file every midnight. 0 0 * * * (Midnight every day). I want the user to enter a value for in_variable(please look at the following code) only the first time when the program runs, and do the rest Every Midnight (without prompting the user to enter anymore values after the very first time). depending on the old input(in_variable), the program should execute the if else statement every midnight. Please let me know if this is possible? any help would be greatly appreciated.
echo "which message would you like to output: "
read in_variable
0 0 * * *
if [ $in_variable -eq "1" ]; then
echo "output message 1" >> file1
else
echo "output message 2" >> file2
fi