I'm trying to read part of a line from a .txt
file, which holds a filename. I use that filename to execute several commando's. However, the variable doesn't seem to resolve correctly.
file.txt
Lookup-File: file.tar.gz
code
lookupFileMD5=`grep -A1 ^Lookup-File $metadataFile | grep ^MD5-Digest | cut -d' ' -f2`
echo "lookupFileMD5=$lookupFileMD5"
lookupFileMD5downloaded=`md5sum $path/$lookupFileName | cut -d' ' -f1`
output
2016-09-29 13:57:00 [INFO] - ++ grep -A1 '^Lookup-File' file.txt
13:57:11 2016-09-29 13:57:02 [INFO] - ++ cut '-d ' -f1
13:57:11 2016-09-29 13:57:02 [INFO] - ++ md5sum $'/path/file.tar.gzr'
13:57:11 2016-09-29 13:57:02 [INFO] - md5sum: /path/file.tar.gz
13:57:11 : No such file or directory
problem
The actual filename is file.tar.gz but in the command (last line) it resolves to md5sum $'/path/file.tar.gzr'
, with the additional $'..r'
.