diff options
author | jilles <jilles@FreeBSD.org> | 2009-10-16 16:17:57 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2009-10-16 16:17:57 +0000 |
commit | 52bf80a1c9ceda3e118d67b2683cdb3b402a1a18 (patch) | |
tree | de2d1d134529fc0c0ad3613b8e6416af7d0a7121 /bin/sh | |
parent | 4fa5145d521ff32cf1d613f40125397082bf2ac9 (diff) | |
download | FreeBSD-src-52bf80a1c9ceda3e118d67b2683cdb3b402a1a18.zip FreeBSD-src-52bf80a1c9ceda3e118d67b2683cdb3b402a1a18.tar.gz |
sh: Show more information about syntax errors in command substitution:
the line number where the command substitution started.
This applies to both the $() and `` forms but is most useful for ``
because the other line number is relative to the enclosed text there.
(For older versions, -v can be used as a workaround.)
Diffstat (limited to 'bin/sh')
-rw-r--r-- | bin/sh/parser.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/bin/sh/parser.c b/bin/sh/parser.c index 9e86162..8dd1e7a 100644 --- a/bin/sh/parser.c +++ b/bin/sh/parser.c @@ -1308,11 +1308,16 @@ parsebackq: { struct jmploc *const savehandler = handler; int savelen; int saveprompt; + const int bq_startlinno = plinno; if (setjmp(jmploc.loc)) { if (str) ckfree(str); handler = savehandler; + if (exception == EXERROR) { + startlinno = bq_startlinno; + synerror("Error in command substitution"); + } longjmp(handler->loc, 1); } INTOFF; |