TWO QUESTIONS:
- Is there a concise way strip the trailing \n of the stdin from version when using <<
- Is there a name for <<< that will help when searching for answers to questions like this? ('IFS' and 'three left angle brackets', etc, haven't been particularly stellar search terms.)
Detail
The following commands feed a trailing \n on MacOS Terminal:
Version A (using echo)
echo SomeText | openssl dgst -sha512 -hex -hmac SomeHmacKey
Version B - (using <<<)
openssl dgst -sha512 -hex -hmac SomeHmacKey <<< SomeText
The Results both Versions A & B are 858337c9909dccb8cb21293f057bd8aa1a90a5ea084b36825e28f8f6a2ef9d813a991dfa7d25fe4afd1f78004213a23dd4e71e05e4cea7f9ad4bf1c5adbd224a
, which is the result for SomeText\n
, as opposed to SomeText
To strip the trailing LF on Version A, I used the solution
echo -n SomeText | openssl dgst -sha512 -hex -hmac SomeHmacKey
Is there a concise way strip the trailing \n of the stdin from version B (i.e. when using <<<)?