Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!pt.cs.cmu.edu!rabbit!stig From: stig@rabbit.ece.cmu.edu (Jonathan Stigelman) Newsgroups: comp.unix.shell Subject: Re: testing if a file is present Message-ID: <11188@pt.cs.cmu.edu> Date: 25 Nov 90 19:20:06 GMT References: <1990Nov21.191638.19469@athena.mit.edu> <2356@sixhub.UUCP> Distribution: comp.unix Organization: ECE Department, Carnegie Mellon University Lines: 14 There's a one line solution that works with both csh & sh... and is particularly handy in makefiles. [ -f foo ] && mv foo bar || echo foo does not exist This is a handy way to deal with the yacc tokens file y.tab.h so that you don't fire lots of extra recompilataions when everything depends on that tokens file. cmp y.tab.h tokens.h && rm y.tab.h || mv y.tab.h tokens.h Cryptic enough? Stig