tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

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



    Date:        Tue, 23 Jul 2024 13:46:48 -0400 (EDT)
    From:        Mouse <mouse%Rodents-Montreal.ORG@localhost>
    Message-ID:  <202407231746.NAA19455%Stone.Rodents-Montreal.ORG@localhost>

  | 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



Home | Main Index | Thread Index | Old Index