D&C GLug - Home Page

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

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

 

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

-- 
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