you are viewing a single comment's thread
view the rest of the comments
[–] 8 points 3 years ago (2 children)

First one has the pitfall of a space at the end of the variable still causing it to fail.

  • source
  • hideshow 4 child comments
  • I don't think this is correct. Consider what you see from using sh -c -- 'var="a " && printf "%s\n" "${var}"-z'

    If "${var}"-z resulted in two arguments instead of one, I'd see "a" and "-z" on different lines, but I see them on the same line, which means they are treated as a single argument.

  • source
  • parent