Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!crdgw1!sixhub!davidsen From: davidsen@sixhub.UUCP (Wm E. Davidsen Jr) Newsgroups: comp.unix.shell Subject: Re: testing if a file is present Message-ID: <2356@sixhub.UUCP> Date: 23 Nov 90 03:07:29 GMT References: <1990Nov21.191638.19469@athena.mit.edu> Reply-To: davidsen@sixhub.UUCP (bill davidsen) Distribution: comp.unix Organization: *IX Public Access UNIX, Schenectady NY Lines: 26 In article <1990Nov21.191638.19469@athena.mit.edu> jik@athena.mit.edu (Jonathan I. Kamens) writes: | In sh, with either a test built-in named "[" or a link in your filesystem | called "[" pointing to the test program: | | if [ -r filename ]; then | ... stuff if filename exists ... | fi | | Some versions of test allow "-e" to test for existence, instead of "-r" to | test for existence and readibility, but mine doesn't, so I use "-r" instead of | "-e" above. In sh without "[": | | if test -r filename; then | ... stuff if filename exists | fi Close but not correct. -f is there a file -r is it readable -x is it executable -- bill davidsen - davidsen@sixhub.uucp (uunet!crdgw1!sixhub!davidsen) sysop *IX BBS and Public Access UNIX moderator of comp.binaries.ibm.pc and 80386 mailing list "Stupidity, like virtue, is its own reward" -me