Suppose I type and run the following command:
sha256sum ubuntu-18.04.1-desktop-amd64.iso
After a delay, this outputs the following:
5748706937539418ee5707bd538c4f5eabae485d17aa49fb13ce2c9b70532433 ubuntu-18.04.1-desktop-amd64.iso
Then, I realize that I should have typed the following command to more rapidly assess whether the SHA‐256 hash matches:
sha256sum ubuntu-18.04.1-desktop-amd64.iso | grep 5748706937539418ee5707bd538c4f5eabae485d17aa49fb13ce2c9b70532433
Is there a way to act on the first output without using the sha256sum
command to verify the checksum a second time (i.e., to avoid the delay that would be caused by doing so)? Specifically:
- I'd like to know how to do this using a command that does not require copy and pasting of the first output's checksum (if it's possible).
- I'd like to know the simplest way to do this using a command that does require copy and pasting of the first output's checksum. (Simply attempting to use
grep
on a double‐quoted pasted checksum (i.e., as a string) doesn't work.)
echo 'pasted string' | grep pattern
or, in shells that provide here-strings,grep pattern <<< 'pasted string'
should work.