-
Consider this snippet: set x a.b.c
echo "$x$(printf d.e.f)" It outputs this:
But I don't understand the result. I would have expected this instead:
Just like in any of these similar snippets: set x a.b.c
echo $x"$(printf d.e.f)"
set x a.b.c
echo "$x"$(printf d.e.f)
set x a.b.c
echo $x$(printf d.e.f)
set x a.b.c
set y "$(printf d.e.f)"
echo "$x$y"
The only syntax that I know of which might explain why some text disappears, is the cartesian product documented at For example: set x a b c
set --erase y
echo $x$y But this requires one of the operands to evaluate to an empty list. And in the original snippet, none of the operands evaluates to an empty list: set x a.b.c
set y $(printf d.e.f)
set --show x
set --show y
Adding quotes around the command substitution in the Where can I learn more about the syntax which explains why |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Oof that's embarassing. The behavior is wrong, we accidentally add the results of the command substitution to the variable name. Fixed by 1b668f5, thanks for reporting |
Beta Was this translation helpful? Give feedback.
Oof that's embarassing. The behavior is wrong, we accidentally add the results of the command substitution to the variable name. Fixed by 1b668f5, thanks for reporting