Re: Closing parenthesis doesn't raise error in backticked command substitution

Stephane Chazelas <[email protected]> Mon, 30 Mar 2026 21:35:02 +0100
Newsgroups org.kernel.vger.dash
Message-ID <[email protected]>
2026-03-30 19:12:58 +0800, Dan Jacobson:
> Please see https://unix.stackexchange.com/questions/805208
> 
> $ ls -og /bin/sh
> lrwxrwxrwx 1 4 2025-02-04  /bin/sh -> dash
> $ m=`seq 1 2 3)`
> 
> Since when is it "OK" to have a trailing ) after the 3?
> 
> $ n=$(seq 4 5 6))
> sh: 2: Syntax error: ")" unexpected
> 
> That's better. (But what is 2? No, it's not line 2 since I started the shell.)
> 
> Package: dash                            
> Version: 0.5.12-12

For the record, that same "bug" in NetBSD sh on which dash I
beleive is initially based on was fixed in
https://github.com/NetBSD/src/commit/fbbbd4fe8c79ac320acd6cc1e6405efa509710b6
in 2008.

https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=11317

-- 
Stephane