Table of Contents
islink
Table of Contents
Prototype: islink(filename)
Return type: boolean
Description: Returns whether the named object filename
is a symbolic
link.
The link node must both exist and be a symbolic link. Hard links cannot be detected using this function.
Notes:
islink()
does not resolve symlinks as part of it's test. If a broken symlink exists, the file is still seen to be a symlink. Usefilestat("myfile", "link target")
to see if a file resolves to a the expected target, and check if the link target exists. Alternatively usetest
withreturnszero()
, for examplereturnszero("/bin/test -f myfile")
.
Arguments:
filename
:string
, in the range:"?(/.*)
Example:
Prepare:
ln -fs /tmp/cfe_testhere.txt /tmp/link
Run:
body common control
{
bundlesequence => { "example" };
}
bundle agent example
{
classes:
"islink" expression => islink("/tmp/link");
reports:
islink::
"It's a link.";
}
Output:
R: It's a link.
See Also: fileexists()
, filestat()
, isdir()
, isplain()
, returnszero()