Now that I think about it, you asked for how to check for a response of just cr-lf. Here's what I should have sent you:
#!/bin/bash echo "Please answer yes or no: " read answer if [ x"$answer" = x"" ]; then echo echo "*** Invalid Response! ***" echo exit -1 fi case $answer in 'yes') echo "The answer is YES!!!!" ;; 'no') echo "The answer is NO!!!!" ;; esac --- Stephen Spalding <[EMAIL PROTECTED]> wrote: > I think what I would do is put a check in for an > empty > response before the case statement is ever reached. > Here's an example of what I mean: > > #!/bin/bash > > echo "Please answer yes or no: " > read answer > > if [[ x"$answer" != x"yes" && x"$answer" != x"no" > ]]; > then > echo > echo "*** Invalid Response! ***" > echo > exit -1 > fi > > case $answer in > 'yes') > echo "The answer is YES!!!!" > ;; > 'no') > echo "The answer is NO!!!!" > ;; > esac > > > > --- Joe Nestlerode <[EMAIL PROTECTED]> > wrote: > > Hello, > > > > Can you put a carriage return (enter) as one of > the > > choices in a 'case' > > construct? *) will catch it, but I need that for > > the "Invalid Choice" > > catch-all at the end. I couldn't find it in the > > documentation; is this > > possible? > > > > Thanks, > > > > Joe > > [EMAIL PROTECTED] > > > > > > > > > > _______________________________________________ > > Redhat-list mailing list > > [EMAIL PROTECTED] > > > https://listman.redhat.com/mailman/listinfo/redhat-list > > > __________________________________________________ > Do You Yahoo!? > Yahoo! Autos - Get free new car price quotes > http://autos.yahoo.com > > > > _______________________________________________ > Redhat-list mailing list > [EMAIL PROTECTED] > https://listman.redhat.com/mailman/listinfo/redhat-list __________________________________________________ Do You Yahoo!? Yahoo! Autos - Get free new car price quotes http://autos.yahoo.com _______________________________________________ Redhat-list mailing list [EMAIL PROTECTED] https://listman.redhat.com/mailman/listinfo/redhat-list