🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #1829

Re: testing if a file is present

#1829
From: Jonathan Stigelman
Date: Sun, 25 Nov 1990 19:20
14 lines
898 bytes
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
Technical Details
Message-ID: <11188@pt.cs.cmu.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!pt.cs.cmu.edu!rabbit!stig
References: <ger.659126250@prisma> <1990Nov21.191638.19469@athena.mit.edu> <2356@sixhub.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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: <ger.659126250@prisma> <1990Nov21.191638.19469@athena.mit.edu> <2356@sixhub.UUCP>
Distribution: comp.unix
Organization: ECE Department, Carnegie Mellon University
Lines: 14