Why does:
[ "a" != "$(printf "\na")" ] && echo true || echo false
print true while:
[ "a" != "$(printf "\n")a" ] && echo true || echo false
print false?
Why does:
[ "a" != "$(printf "\na")" ] && echo true || echo false
print true while:
[ "a" != "$(printf "\n")a" ] && echo true || echo false
print false?
I think it is because $(...). That substitution automatically remove ending newline character. That's a good default behaviour.