For recursive links, how do I restrict the number of symbolic links to follow?
Use the “-l link-depth” option. The link-depth argument is either a numeric value (number of symblic links to follow) or the keyword “unlimited”. Note: Normally it is not necessary to restrict the number of symbolic links. Some simple programs follow each symbolic link. If a symbolic link points back to a parent, grandparent… directory these programs go into an infinite loop. The kls program doesn’t. When traversing directories recursively it keeps track of the parent, grandparent… directories already visited by device number and inode number. Before opening a new directory, device and inode number are checked and compared against all parent, grandparent… directories already in the search path. Only those directories not yet visited are opened for inspection.