This question already has an answer here:
Following is the command which is in shell script.
var="$(sshpass -p 'password' ssh -o "StrictHostKeyChecking=no" username@hostip <<-EOF
command to run on remote host
EOF
)"
when i echo $var, output is displayed without spaces and new line i.e, trimming spaces and new lines. i need complete output from the remote host with spaces and new line.
On Running Manually through CLI, getting correct output i.e, with spaces and line. But on echoing the varibale($var) output getting trimmed.
tried this echo ${var}, still no luck, getting output trimmed of white spaces and new line.