Search code examples
bashunixmd5sum

how to fix md5sum:"No such file or directory" error?


I have a bash script which has to perform a md5sum on two files. The two files do exists in the path specified in the first argument of md5sum, however, I get a no such file or directory error for both of them.

The script is the following:

#!/bin/bash

md51=$(md5sum /tmp/data/hello | cut -d " " -f 1)
md52=$(md5sum /tmp/data/there | cut -d " " -f 1)

exit 0

and I cannot modify the script, since it has been given to me written like that. Do you have any idea why I get the no such file or directory error, even though the files do exist in the correct location? Might it be an issue related to my OS (which is Ubuntu 15.10 Wily) ?

Thank you!


Solution

  • /home/yourname/Desktop/tmp/data/ is a different location than /tmp/data/

    / at the beginning of a path is the root directory. Kind of the unix counter-part to "C:\" of windows ( - very over-simplified explanation).