Reputation: 305
I've this file whose name is : 2157-15211-csv (1).csv
obviously, to get it's md5sum, i must escape the parenthesis by quoting and write
md5sum '2157-15211-csv (1).csv' : this works
But the filename comes from another process, that puts it in a variable, so my command is more like
myVar='2157-15211-csv (1).csv';md5sum $myVar
but this fails
I tried this myVar=CURRENT="'2157-15211-csv (1).csv'"
if I echo $myVar I get '2157-15211-csv (1).csv', but
md5sum $myVar still fails due to the parenthesis
Does anybody knows how to make sure md5sum works with filename that are stored in a variable and contains parenthesis ?
Thanks a lot
Upvotes: 0
Views: 892
Reputation: 1623
You need to quote the variable so it comes across as a single parameter:
md5sum "$myVar"
Upvotes: 2