I want to call dialog Γ la:
dialog --menu Choose: 0 40 10 A '' B '' C ''
except A , B and C are the result of a dynamic query, the last one for this question is { echo A; echo B; echo C; } { echo A; echo B; echo C; } { echo A; echo B; echo C; } .
I can get the desired command line, apparently:
{ echo A; echo B; echo C; } | sed -e "s/\$/ ''/;"
a
echo $({ echo A; echo B; echo C; } | sed -e "s/\$/ ''/;")
and its conclusion:
A '' B '' C ''
show that the result of the command substitution is word-broken only, but '' not interpreted as an empty argument, but is passed verbatim to echo (and, therefore, the dialog will not display descriptions for menu items, but literally '' s).
I can get around this in bash using arrays, but is there a simpler solution that I am missing?
Considering
$ e() { printf "tag: [$1] item: [$2]"; } $ e $(echo "A ''") $ tag: [A] item: ['']
How can I change part of $(...) so that the element is [] instead of [''] .
source share