I am trying to see if a new line has been matched. The reason is that my script asks for the user’s name. If they press enter, then a default name is used.
The problem is I cannot seem to check whether they have pressed enter, or used a name of their own. I have searched a lot on the net, and can’t find a working answer. Here is what I have tried to implement:
if [ `expr match "$temp1" "\n"` != 0 ]
Very new to this. Thanks!
Try something like this: