Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Why do I become a different hash when I try:
md5 <<< "Hello"
md5 -s "Hello"
Is it because of a possible line break in the first example?

share|improve this question
When in doubt, dump your data. od -xa <<< 'Hello' or xxd <<< 'Hello' will show you an extra trailing newline. – manatwork Apr 4 '13 at 15:12
up vote 2 down vote accepted

Heredocs (thats what <<< is called) in bash always end with a newline character. There is no way to disable this behavior. This newline character is what is throwing off the checksum.

share|improve this answer
Note that bash copied that feature (called herestring not heredoc) from ksh93 which itself copied it from zsh which itself copied it from the Plan 9 shell rc. rc did not add the trailing newline character. ksh93, zsh and bash do. – Stéphane Chazelas Apr 4 '13 at 21:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.