[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: maybe some of these "case" reactions are no-no's
From: |
Paul Jarc |
Subject: |
Re: maybe some of these "case" reactions are no-no's |
Date: |
Tue, 09 Apr 2002 20:12:20 -0400 |
User-agent: |
Gnus/5.090006 (Oort Gnus v0.06) Emacs/20.7 (i386-redhat-linux-gnu) |
Dan Jacobson <jidanni@deadspam.com> wrote:
> In the manual is says
> case word in [ [(] pattern [ | pattern ] ... ) list ;; ]
> ... esac
>
> $ case esac
>> #odd, why is it asking for another line instead of failing?
"esac" is a word. There is no error yet. "in" is expected next.
man bash:
The following words are recognized as reserved when unquoted
and either the first word of a simple comĀ mand (see SHELL
GRAMMAR below) or the third word of a case or for command:
[...] esac
In this context, "esac" is not considered a reserved word.
> $ case a in b);;esac
No problem with this code, AFAIK, so this would be a documentation
bug.
> $ case a in b)esac #odd. what about ;;?
Looks like that ought to fail.
> $ case a in b);esac
> bash: syntax error near unexpected token `;e'
Correct failure, bad error message. Something like this has been
discussed here already.
> $ case a in b): esac
>>
> $ case a in b)date esac
>>
You've given a command with an argument of "esac". ";;" or another
command is expected next.
> $ case a in b)date ;esac
> $ case b in b)date ;esac
> Tue 04 9 21:12:29 CST 2002
Looks like that ought to fail.
paul