Path: 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: <1990Nov21.155149.3505@informix.com> <2549@root44.co.uk> Distribution: comp.unix Organization: 4455 Province Line Rd., Princeton, NJ 08540 Lines: 23 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