On Mon, 11 Feb 2002 21:22:06 -0500, Neal Lippman <[EMAIL PROTECTED]> wrote:

> Sorry for OT posting; I am not sure if there is a newsgroups for bash 
> experts, so I figured I'd try here.
> 
> I need to be able to write a bash script that can copy files from a directory 
> who's name includes a space (long story, but it's a windows directory under 
> Win98 on a machine on my network).
> 
> Anyway, supposing that the directory is "/mount/windows/spaced name" and I 
> need to copy all of the files in the directory to a target.
> 
> At a bash prompt, I can issue either:
> cp "/mount/windows/spaced name/*" target 
> OR
> cp /mount/windows/spaced\ name/* target
> and all works fine.
> 
> However, from within a bash script, something like:
> 
> #!/bin/sh
> sourcedir=/mount/windows/spaced\ name
> cp $sourcedir/* target

  cp "${sourcedir}"/* target

Need the "*" outside the quotes since it's the shell doing the globbing, 
not "cp".

-- 
Eric G. Miller <egm2@jps.net>

Reply via email to