D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Makefiles - mv with wildcard that may not match anything

 

Simon Williams wrote:
> Hello everyone.
>
> I'm trying to add something to make clean that will move all *~ files 
> into a .backups dir. The problem is that I don't want make to return an 
> error if I run make clean when there are no ~ files. Currently I have:
>
> mkdir -p .backups
> if [ "`echo *~`" != "*~" ]; then mv -f *~ .backups ; fi
>
> Which does work, but it's a bit cumbersome. Is there a better way
> of doing it?
>
> Thanks
> Simon
>
>   
can you just use   ls -al *~    instead of echo? To search for the 
existence of ~   Or even tar all *~ up then move.

-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html