Copying files with spaces in them

Chris F.A. Johnson cfaj-uVmiyxGBW52XDw4h08c5KA at public.gmane.org
Wed Jan 28 23:04:28 UTC 2009


On Wed, 28 Jan 2009, Christopher Browne wrote:

> I've got a Makefile that is trying to copy man pages into place;
> unfortunately, since they are (somewhat legitimately) created with
> spaces in them,

    There's NO excuse for that.

> the following breaks:
>
>        for file in $(wildcard man1/*) ; do \
>          $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/man1 || exit;\
>       done
>       for file in $(wildcard man7/*) ; do \
>         $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/man7 || exit;\
>       done
>
> I'll bet Chris Johnson would have a better idiom he could suggest offhand ;-).

     A makefile is not a shell script. In a shell script, I would use:

for file in man1/*
do
    cp "$file" "$DESTDIR/$mandir"/man1 || exit
done

-- 
    Chris F.A. Johnson, webmaster         <http://woodbine-gerrard.com>
    ========= Do not reply to the From: address; use Reply-To: ========
    Author:
    Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list