3 ms·
test -L checks if a file is a symlink; no need for realpath comparisons (which is slower)
by nunez 3y ago
test -L checks if a file is a symlink; no need for realpath comparisons (which is slower)
- tux2bsd 3y ago> checks if a file is a symlink to expand on that: "In computing, a symbolic link (also symlink or soft link) is a file whose purpose is to point to a file or directory (called the "target") by specifying a path thereto."
- somat 3y agoYeah but what do you do if your are not using shell? Hint: it's stat(2) (or equivalent in your language library) Additional hint: if using pythons os.stat set follow_symlinks to false. It recently took me an embarrassing long time to figure out why my script was failing to find symlinks.