[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Off Topic - Bash Question



Once upon a time, Bill Gradwohl <bill 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 hiwaay net>
Systems and Network Administrator - HiWAAY Internet Services
I don't speak for anybody but myself - that's enough trouble.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]