🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #1824

Re: testing if a file is present

#1824
From: Jon H. LaBadie
Date: Fri, 30 Nov 1990 19:26
23 lines
1126 bytes
In article <2549@root44.co.uk>, gwc@root.co.uk (Geoff Clare) writes:
> 
> 	test -f file -o -d file -o -c file -o -b file -o -p file
> 
> but I don't count that as "equivalent"!
> 

OK, granted, but how about the nearly equivalent

	test ! -f file

It will be true when you want a regular file of the indicated name
and false if said file does not exist or is a type other than regular.

Another possibility not mentioned in this thread (and with its own
limitations) is test -s file.  For this to be true, the file must
exist and have some content (i.e. not an empty file).

Jon

-- 
Jon LaBadie
{att, princeton, bcr, attmail!auxnj}!jonlab!jon
Technical Details
Message-ID: <891@jonlab.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!rutgers!njin!princeton!jonlab!jon
References: <ger.659126250@prisma> <1990Nov21.155149.3505@informix.com> <2549@root44.co.uk>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!rutgers!njin!princeton!jonlab!jon
From: jon@jonlab.UUCP (Jon H. LaBadie)
Newsgroups: comp.unix.shell
Subject: Re: testing if a file is present
Message-ID: <891@jonlab.UUCP>
Date: 30 Nov 90 19:26:50 GMT
References: <ger.659126250@prisma> <1990Nov21.155149.3505@informix.com> <2549@root44.co.uk>
Distribution: comp.unix
Organization: 4455 Province Line Rd., Princeton, NJ 08540
Lines: 23