layout | title | published |
---|---|---|
default |
islink |
true |
[%CFEngine_function_prototype(filename)%]
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")
.
[%CFEngine_function_attributes(filename)%]
Example:
Prepare:
[%CFEngine_include_snippet(islink.cf, #+begin_src prep, .*end_src)%]
Run:
[%CFEngine_include_snippet(islink.cf, #+begin_src cfengine3, .*end_src)%]
Output:
[%CFEngine_include_snippet(islink.cf, #+begin_src\s+example_output\s*, .*end_src)%]
See also: fileexists()
, filestat()
, isdir()
, isplain()
, returnszero()