How to remove newline from output?

Viewed 22632

Hashing passwords in shell (sha512) breaks the line. How to get a result in one line?

The script for hashing:

password="abc123"
hashPassw="$(/bin/echo -n "${password}" | openssl dgst -binary -sha512 | openssl enc -base64)"
echo "${hashPassw}"

Output is (why breaks the line?):

xwtd2ev7b1HQnUEytxcMnSB1CnhS8AaA9lZY8DEOgQBW5nY8NMmgCw6UAHb1RJXB
afwjAszrMSA5JxxDRpUH3A==

Should be one line:

xwtd2ev7b1HQnUEytxcMnSB1CnhS8AaA9lZY8DEOgQBW5nY8NMmgCw6UAHb1RJXBafwjAszrMSA5JxxDRpUH3A==
2 Answers
Related