Off Topic - Bash Question

Chris Adams cmadams at hiwaay.net
Tue Sep 28 20:03:20 UTC 2004


Once upon a time, Bill Gradwohl <bill at ycc.com> said:
> # This works
> fileName='abc.xyz'
> md5sum=$(md5sum ${fileName})
> 
> # This doesn't
> fileName='spaces in file name.xyz'
> md5sum=$(md5sum ${fileName})

# How about
fileName='spaces in file name.xyz'
md5sum=$(md5sum "${fileName}")

The key is that you need to put quotes around the file name (using
double quotes; single quotes block variable expansion).
-- 
Chris Adams <cmadams at hiwaay.net>
Systems and Network Administrator - HiWAAY Internet Services
I don't speak for anybody but myself - that's enough trouble.




More information about the fedora-list mailing list