I found something very weird!
Should I report that as a bug or is it me misusing the command?
I've got a file with a backslash in its name.
I know it's a horrible policy but it's not me.
The file came from a mac computer because this is a backup server.
Anyway, when using md5sum on the file, I get a very weird output.
Check it out :
You have to prevent the shell from expanding the file name. Try not globbing the names, "*", rather put the name inside single quotes '/tmp/file\2'
We have C code to handle file names from a SAN directory of wierd PC shares (opendir, readdir) that encapsulates all of the filenames with single tics to be able to work with files on those directories. Assuming you do not want to rename the file.
So if creating an md5sum file to later check, this is OK, if you want md5sum of file for something else, redirection saves a cat.. sum=$(md5sum < "$file" | cut)