Michael Gilbert wrote: > say I have a certain file with a name that has a space in it such as > "test 1.file"
Handling spaces in names has always required extra care. Since the space is also in the set of the IFS (input field separator) characters it is a little tricky to get it right. > now, I want to compute the sha1 sum of this file, so I can do > sha1sum "test 1.file" Note that you have individually quoted that filename. > sha1sum $(ls -Q "test 1.file") > > where ls -Q "test 1.file" produces "test 1.file" as output, which > appears to be the exact same text that I manually entered in the first > example. however, the output of that command is ls -Q produces quotes on output. But you need to use shell 'eval' if you want the shell to process the line again looking for quotes. The shell has already done the quote processing pass across the command line by this time and won't do it again. > "test: No such file or directory > 1.file": No such file or directory Note the '"' chars are actually part of the file names here. Try this instead: eval sha1sum $(ls -Q "test 1.file") > this, I believe is incorrect behavior. i would expect the same sha1 sum > as in the first example to be generated. note that sha1sum can be > replaced by md5sum in the above examples and the same behavior will > be observed. This actually has nothing to do with sha1sum nor md5sum. This is a shell command line processing behavior. You can create the same example using ls. eval ls -ld $(ls -Q "test 1.file") I recommend using zero terminated strings using find's -print0 construct. I assume the 'ls' in your examples is just a smaller example of the larger problem. Instead of trying to use shell quoting and wrapping the filename in another layer of quotes instead use zstrings (zero terminated strings). find . -maxdepth 1 -type f -print0 | xargs -r0 sh1sum Bob -- Bob Proulx <[EMAIL PROTECTED]> http://www.proulx.com/~bob/ -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]