- #1
jameson2
- 53
- 0
Getting bash shell script to do one thing if user hits "enter".
I need to write a program that will output a line in a calendar file if a date is entered, or if no date is entered and the user just hits "enter" to ouput the line corresponding to today's date.
I think that it must take the form of an if statement, along the lines of if(date is entered) then print the line, else print today's line. Or maybe if date is entered do such and such, if user hits enter do something else. But I don't know how to translate "user hits enter" into the shell language, or user enters date now that I think about it. Any help would be great. User hit's enter would be the most useful in my opiniono, thanks.
I need to write a program that will output a line in a calendar file if a date is entered, or if no date is entered and the user just hits "enter" to ouput the line corresponding to today's date.
I think that it must take the form of an if statement, along the lines of if(date is entered) then print the line, else print today's line. Or maybe if date is entered do such and such, if user hits enter do something else. But I don't know how to translate "user hits enter" into the shell language, or user enters date now that I think about it. Any help would be great. User hit's enter would be the most useful in my opiniono, thanks.