Re: test.1 -> "if file exists" -> "if pathname resolves to an existing directory entry"

Mouse <[email protected]>
Newsgroups gmane.os.netbsd.devel.userlevel
Message-ID <[email protected]>
> If you need a single (unraceable) test, that can often be achieved by
> attempting to make a link to the target filename, as link(2) and
> hence ln(1) without -f will fail if the target name exists.

Yes, but it requires that you're running as a user which can write to
the target filesystem, and, if the target doesn't exist, it will create
it.  For some purposes, stat -L might help, though in a small test I
just did that printed data for the link when applied to an existing
link whose target is nonexistent.

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		[email protected]
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.