[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1063518: console-setup: setupcon: 1386: Syntax error: Missing '))'



09.02.2024 17:57, Thorsten Bonow :
dash << 'EOF'                                            [15:28:53]
if $( (true) 2>/dev/null); then
  echo "42"
fi
EOF
42

which only works in dash because of the added space between the command substitution $(...) and the subshell (...).

Does dash think it has to do arithmetic expansion "$((...))"?

Yes, arithmetic, and that's what bash does too.  dash does not understand
space between two closing parens though, ') )'.  And this is logical - if
the opening is "((", use the same matching "))" for closing.

$(( ... )) is arithmetic expression,
$( ( ... ) ) is a subshell.

Everything else is asking for trouble like this.

But what's POSIX take on this?  I couldn't find anything.  Is this a bug in dash or in setupcon?

It's a bug in setupcon.

/mjt


Reply to: