Synchronize command substitution exit status

Trim trailing whitespace in command substitution output