I have the statement:
A=$(echo "echo a") && bash -c "awk -v var=\"$A\" 'BEGIN {printf \"%20s\", var}'"
Which outputs:
echo az
And I can't make this one-liner work:
A=$(echo "echo a") && bash -c "paste <(awk -v var="$A" 'BEGIN {printf \"%-200s\n\", var}') <(echo "BBBB") --delimiters ''"
a 'BEGIN {printf "%-200s\n", var}') <(echo BBBB) --delimiters '': -c: line 0: unexpected EOF while looking for matching `)'
a 'BEGIN {printf "%-200s\n", var}') <(echo BBBB) --delimiters '': -c: line 1: syntax error: unexpected end of file
I presume this is because "$A"
is not treated as a variable. Can someone explain this to me. Thanks!