hi neal

i think you also need to watch out for other ms windoze gotchas

space in filenames are easy to handle...

more common problems for tar, cp and other unix utils ...
        /home/me/tom's proposal/
                ticks is a major problem

        /home/me/ leading spaced names/
        
        /home/me/windoze_user/for fun:/         or was it $

        /home/me/windoze_user/' things on sale for $1.oo'
                - using '  to signify users choices of ms filenames

        in the file name that windoze allows that is NOT valid in *nix

ie... pre-process your list of illegal file names before coming from
  windoze to *nix...or you'll have some problems...

it also seem to have depended on which linux distro, which samba version
and tar, find, cp that had varying degree of "[EMAIL PROTECTED]" those file 
names
again

have fun
alvin

On Mon, 11 Feb 2002, Neal Lippman 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
> 
> fails, because the space isn't properly passed to cp, AND further the shell 
> doesn't do expansion on the wild card in the file name.
> 
> I have tried all sorts of variants:
> sourcedir="/mount/windows/spaced\ name"
> sourcedir="/mount/windows/spaced\\ name"
> sourcedir=/mount/windows/spaced\\ name"
> 
> and the cp command with various quotes and not quotes, and cannot seem to get 
> this to work. Within the script, if I try:
> 
> sourcedir="mount/windows/spaced\ name"
> anotherdir="mount/windows"
> echo $sourcedir/*
> echo $anotherdir/*
> 
> the first echo shows that there is no expansion of the wild card, while the 
> second echo works as expected, echoing the name of every file in 
> /mount/windows.
> 
> Clearly the problem is that dreadful space in the directory name. Any help on 
> how to syntax this greatly appreciated.
> 
> Thanks.
> N
> 
> 
> -- 
> To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
> with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
> 

Reply via email to