
If more than one of -H, -L and -P is specified, each overrides the others the last one appearing on the command line takes effect. If -H is in effect and one of the paths specified on the command line is a symbolic link to a directory, the contents of that directory are examined (though specifying -maxdepth 0 would prevent this). The information about the link itself is used as a fallback if the file pointed to by the symbolic link cannot be examined. For that situation, the information used is taken from whatever the link points to (that is, the link is followed). The only exception to this behaviour is when a file specified on the command line is a symbolic link, and the link can be resolved. When find examines or prints information about files, the information used is taken from the properties of the symbolic link itself. Using -L causes the -lname and -ilname predicates always to return false.ĭo not follow symbolic links, except while processing the command line arguments.

When the -L option is in effect, the -type predicate always matches against the type of the file that a symbolic link points to rather than the link itself (unless the symbolic link is broken). If -L is in effect and find discovers a symbolic link to a subdirectory during its search, the subdirectory pointed to by the symbolic link is searched. If you later use the -P option, -noleaf is still in effect.

When find examines or prints information about files, the information used is taken from the properties of the file that the link points, not from the link itself (unless it is a broken symbolic link or find cannot examine the file that the link points). When find examines or prints information a file, and the file is a symbolic link, the information used is taken from the properties of the symbolic link itself.įollow symbolic links. " or " /" is generally safer if you use wildcards in the list of start points). A double-dash (" -") can also be used to signal that any remaining arguments are not options (though ensuring that all start points begin with either ". The arguments in the expression list are also referred to as "options," but the five "real" options -H, -L, -P, -D and -O must appear before the first path name, if they are used at all. If no expression is given, the expression -print is used (but consider using -print0 instead. If no paths are given, the current directory is used. That argument and any following arguments are taken to be the expression describing what is being searched. Arguments following these are taken to be names of files or directories to be examined, up to the first argument that begins with " -", or the argument " (" or " !". The -H, -L and -P options control the treatment of symbolic links. It can be used on its own to locate files, or in conjunction with other programs to perform operations on those files. At that point find moves on to the next path until all paths are searched.įind is a fundamental and extremely powerful tool for working with the files on your linux system. The outcome is "known" when the left side of the expression is determined to be FALSE for AND operations, or TRUE for OR operations. Within each directory tree specified by the given paths, it evaluates the given expression from left to right, according to the rules of precedence (see " Operators", below) until the outcome is known.


SCRIPT_DIR=$( cd - "$( dirname - "$" instead.
