(imported topic written by MattPeterson)
I’m having issues finding symlinks in Linux if the file the link points to is missing.
If the fine and link both exist the inspectors work fine:
ls -lrta
-rw-r–r-- 1 root root 7 Jul 24 09:29 testfile
lrwxrwxrwx 1 root root 8 Jul 24 09:30 testlink -> testfile
Q: exist symlink whose (name of it contains “testlink”) of folder “/var/opt/test”
A: True
T: 10521
However, if I the file is missing (testfile in this case), then I cannot use the statement I used above.
rm -rf testfile
ls -lrt
total 4
lrwxrwxrwx 1 root root 8 Jul 24 09:30 testlink -> testfile
Q: exist symlink whose (name of it contains “testlink”) of folder “/var/opt/test”
A: False
T: 8535
The statement above should return true, because I’m looking for the existence of the symlink and not the file. If I look for the symlink directly (without the whose statement), it returns true…
Q: exist symlink “testlink” of folder “/var/opt/test”
A: True
T: 584
The statement below should return the name of my sylink, however if the file is missing, then it will not return anything.
Q: names of symlinks of folder “/var/opt/test”
T: 353