Hello Together
I am new here, as well as on Linux or Ubuntu.
Need to write a useful shell script that does something useful as an exercise.
For this I have decided on a small program that helps you choose a restaurant. For this, of course, you need to know what you like to eat.
The task says that you have to use statements and loops.
I have already used statements, but I don't know what kind of useful loop I could use? Do you have any ideas, or what else could I program? I don't know much about loops!
I thought that in the main program I could use a while loop to adjust the time instead of If.
See the "code section"
I am new here, as well as on Linux or Ubuntu.
Need to write a useful shell script that does something useful as an exercise.
For this I have decided on a small program that helps you choose a restaurant. For this, of course, you need to know what you like to eat.
The task says that you have to use statements and loops.
I have already used statements, but I don't know what kind of useful loop I could use? Do you have any ideas, or what else could I program? I don't know much about loops!
I thought that in the main program I could use a while loop to adjust the time instead of If.
See the "code section"
Code:
###################### Main Program #######################
if [ $HOUR -gt 11 ] && [ $HOUR -lt 14 ]; then
echo "Time for lunch: "
choosefood
else
if [ $HOUR -gt 17 ] && [ $HOUR -lt 21 ]; then
echo "Time for dinner: "
choosefood
else
echo "It isn't time o eat!!"
fi
fi
#################### End Main Program #####################