Robertico Robertico - 11 months ago 86
Bash Question

Only get hash value using md5sum (without filename)

I use md5sum to generate a hash value for a file.
But i only need to receive the hash value, not the file name.

md5=`md5sum ${my_iso_file}`
echo ${md5}

3abb17b66815bc7946cefe727737d295 ./iso/somefile.iso

How can i 'strip' the file name and only remain the value ?

jyz jyz
Answer Source

Well another way :)

md5=`md5sum ${my_iso_file} | awk '{ print $1 }'`