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

Robert Elz <[email protected]>
Newsgroups gmane.os.netbsd.devel.userlevel
Message-ID <[email protected]>
    Date:        Tue, 23 Jul 2024 13:46:48 -0400 (EDT)
    From:        Mouse <[email protected]>
    Message-ID:  <[email protected]>

  | 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.

All true.

  | 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.

Which would not be a problem for the OP, whose intent seemed to be
to be able to test for a name existing, regardless of what type it is.

	stat -qL -f '' file

looks like it would do admirably for that purpose.

kre
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.