Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14576 > unrolled thread
| Started by | L A Walsh <bash@tlinx.org> |
|---|---|
| First post | 2018-09-12 19:29 -0700 |
| Last post | 2018-09-12 19:29 -0700 |
| Articles | 1 — 1 participant |
Back to article view | Back to gnu.bash.bug
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: error message for missing fi is not helpful L A Walsh <bash@tlinx.org> - 2018-09-12 19:29 -0700
| From | L A Walsh <bash@tlinx.org> |
|---|---|
| Date | 2018-09-12 19:29 -0700 |
| Subject | Re: error message for missing fi is not helpful |
| Message-ID | <mailman.706.1536805765.1284.bug-bash@gnu.org> |
[Multipart message — attachments visible in raw view] — view raw
On 9/12/2018 6:35 AM, Chet Ramey wrote:
> On 9/12/18 5:17 AM, Manuel Reiter wrote:
>
>
>> Bash Version: 4.4
>> Patch Level: 12
>> Release Status: release
>>
>> ++ Description:
>>
>> When an if statement is not terminated by a fi, bash's error message is
>> not helpful in locating the problem.
>>
>
> This is tough to do in a bison-generated parser. If someone would like to
> build the structures required to keep track of which conditional command
> the shell is currently parsing, and incorporate that into an error
> message, I'd be happy to look at it.
>
> Chet
>
This isn't *exactly* what you wanted, but this gives the line number
of the last unmatched statement (but doesn't tell you what the statement
was). The diff was against bash-4.4.23 (4.4 base w/23 patches)
I can't speak for formatting or base-specific function usage, but I don't
think there was any of those.
Anyway, if you store the word in a separate array where the line #
is stored, you _could_ list the matching word, but I suspect just the
line it started on would be enough for most users.
--- (eoftest.sh)
#!/bin/bash
if ((1)); then
for i in 1 2 3; do
echo wow
---
> ./bash eoftest.sh
eoftest.sh: line 10: syntax error: unexpected end of file from line 4.
The wording was just what I threw in. I don't _need_ attribution for
this if that makes it easier.
Back to top | Article view | gnu.bash.bug
csiph-web