Last Updated: February 25, 2016
·
643
· trinitronx

Copy a file's sha256 checksum to clipboard

While working with the remote_file resource in Chef, I needed a quick way to copy a file's sha256 sum to my clipboard for use in attributes.

I came up with the following bash function for OSX:

sha256()
{ 
  shasum -a 256 "$1" | awk '{ print $1 }' | pbcopy
}