aefind(1) aefind(1) NNAAMMEE aefind - search for files in directory hierarchy SSYYNNOOPPSSIISS aaeeffiinndd [ _o_p_t_i_o_n... ] _p_a_t_h... _e_x_p_r_e_s_s_i_o_n aaeeffiinndd --HHeellpp aaeeffiinndd --VVEERRSSiioonn DDEESSCCRRIIPPTTIIOONN The _a_e_f_i_n_d command is used to search the combined directory tree of a change and its project. It is intentionally similar to _f_i_n_d _(_1_)_, however it unifies the directory stack of a change and its branch baseline, and the branch's ancestors' baselines if any. For each file found in the directory tree, the given expression is evaluated from left to right, according to the rules of precedence (see the section on OPERATORS, below), only until the outcome is known, at which point aefind moves on to the next file name. OOPPTTIIOONNSS The following options are understood: --BBaasseeLLiinnee This option may be used to specify that the project baseline is the subject of the command. --BBAAssee__RREEllaattiivvee This option may be used to cause relative filenames to be considered relative to the base of the source tree. See _a_e_u_c_o_n_f(5) for the corresponding user preference. --CCUUrrrreenntt__RREEllaattiivvee This option may be used to cause relative filenames to be considered relative to the current directory. This is usually the default. See _a_e_u_c_o_n_f(5) for the corresponding user preference. --CChhaannggee _n_u_m_b_e_r This option may be used to specify a particular change within a project. When no --CChhaannggee option is specified, the _A_E_G_I_S___C_H_A_N_G_E environment variable is consulted. If that does not exist, the user's _$_H_O_M_E_/_._a_e_g_i_s_r_c file is examined for a default change field (see _a_e_u_c_o_n_f(5) for more information). If that does not exist, when the user is only working on one change within a project, that is the default change number. Otherwise, it is an error. --HHeellpp This option may be used to obtain more information about how to use the _a_e_f_i_n_d program. --PPrroojjeecctt _n_a_m_e This option may be used to select the project of interest. When no --PPrroojjeecctt option is specified, the _A_E_G_I_S___P_R_O_J_E_C_T environment variable is consulted. If that does not exist, the user's _$_H_O_M_E_/_._a_e_g_i_s_r_c file is examined for a default project field (see _a_e_u_c_o_n_f(5) for more information). If that does not exist, when the user is only working on changes within a single project, the project name defaults to that project. Otherwise, it is an error. --RReessoollvvee This option may be used to request that filenames be absolute paths, referring to the fully resolved file name. By default, relative file names are used, relative to the root of the ``stacked'' directory tree. --VVeerrbboossee This option may be used to request that the expression be printed again on the standard output. This is the expression as understood by _a_e_f_i_n_d, to assist you in ensuring that you and the command agree. The expression is fully parenthesized, and all implicit operators made explicit. Where possible, constant expressions will have been folded. See also _a_e_g_i_s(1) for options common to all aegis commands. All options may be abbreviated; the abbreviation is documented as the upper case letters, all lower case letters and underscores (_) are optional. You must use consecutive sequences of optional letters. All options are case insensitive, you may type them in upper case or lower case or a combination of both, case is not important. For example: the arguments "-project, "-PROJ" and "-p" are all interpreted to mean the --PPrroojjeecctt option. The argument "-prj" will not be understood, because consecutive optional characters were not supplied. Options and other command line arguments may be mixed arbitrarily on the command line, after the function selectors. The GNU long option names are understood. Since all option names for _a_e_f_i_n_d are long, this means ignoring the extra leading '-'. The "----_o_p_t_i_o_n==_v_a_l_u_e" convention is also understood. EEXXPPRREESSSSIIOONNSS The expression is made up of basic elements, tests (which return a true or false value), and actions (which have side effects and return a true or false value), all separated by operators. BBAASSIICC EELLEEMMEENNTTSS {{}} The value of this expression is the full file name of the file currently being considered. The value is affected the the --RReessoollvvee option. _n_u_m_b_e_r Numbers may be specified directly, for use with other tests and operators. In the style of C, they may be hexadecimal with a ``0x'' prefix, octal with a ``0'' prefix, or decimal otherwise. _s_t_r_i_n_g Strings may be specified directly, for use with other tests and operators. If the string contains shell meta-characters, you may need to quote it. --FFAAllssee The value of this expression is always false. --NNOOWW The value of this expression is the current time, at the start of execution. --TTRRuuee The value of this expression is always true. OOPPEERRAATTOORRSS The --aanndd operator is assumed where the operator is omitted. You will need to quote many of the operators, to protect them from interpretation by the shell. Each operator must be a separate command line argument. (( _e_x_p_r )) Force precedence. ++ _e_x_p_r Unary plus. Is is an error if the argument cannot be coerced to a number. -- _e_x_p_r Unary minus. Result is the numeric negative of the argument. Is is an error if the argument cannot be coerced to a number. !! _e_x_p_r Logical negation of the sense of the expression. Is is an error if the argument cannot be coerced to a boolean. Synonym: --NNoott ~~ _e_x_p_r Bitwise not of the argument. Is is an error if the argument cannot be coerced to an integer. _e_x_p_r_1 ** _e_x_p_r_2 This operation multiplies the two values. Is is an error if the arguments cannot be coerced to numbers. _e_x_p_r_1 // _e_x_p_r_2 This operation divides the argument value by the second. Is is an error if the arguments cannot be coerced to numbers. Is is an error if the second argument is zero. _e_x_p_r_1 %% _e_x_p_r_2 This operation produces the remainder of the division of the first argument by the argument. Is is an error if the arguments cannot be coerced to numbers. Is is an error if the second argument is zero. _e_x_p_r_1 ~~ _e_x_p_r_2 Is is an error if the arguments cannot be coerced to strings. Is is an error if the first argument is not a valid pattern. The first argument is the pattern, and the second is the string The result is true if the pattern matches, and false if it does not. This operation performs a shell file pattern comparison. to be compared. _e_x_p_r_1 ++ _e_x_p_r_2 This operation adds the two values. Is is an error if the values cannot be coerced to numbers. _e_x_p_r_1 -- _e_x_p_r_2 This operation subtracts the second values from the first. Is is an error if the values cannot be coerced to numbers. _e_x_p_r_1 #### _e_x_p_r_2 This operation concatenates the arguments. Is is an error if the arguments cannot be coerced to strings. (Note: this is _n_o_t the same as the :: operator of the _e_x_p_r(1) command.) _e_x_p_r_1 <<<< _e_x_p_r_2 Shift the first argument left by the number of bits specified by the second argument. The left argument is treated as an _u_n_s_i_g_n_e_d number. Is is an error if the values cannot be coerced to numbers. _e_x_p_r_1 >>>> _e_x_p_r_2 Shift the first argument right by the number of bits specified by the second argument. The left argument is treated as an _u_n_s_i_g_n_e_d number. Is is an error if the values cannot be coerced to numbers. _e_x_p_r_1 << _e_x_p_r_2 Compare the values and produce true if the first value is less than the second value, false otherwise. If both values can be coerced to numbers, the comparison is numeric; if both values can be coerced to strings, the comparison is lexicographic; otherwise is it an error. _e_x_p_r_1 <<== _e_x_p_r_2 Compare the values and produce true if the first value is less than or equal to the second value, false otherwise. If both values can be coerced to numbers, the comparison is numeric; if both values can be coerced to strings, the comparison is lexicographic; otherwise is it an error. _e_x_p_r_1 >> _e_x_p_r_2 Compare the values and produce true if the first value is greater than the second value, false otherwise. If both values can be coerced to numbers, the comparison is numeric; if both values can be coerced to strings, the comparison is lexicographic; otherwise is it an error. _e_x_p_r_1 >>== _e_x_p_r_2 Compare the values and produce true if the first value is greater than or equal to the second value, false otherwise. If both values can be coerced to numbers, the comparison is numeric; if both values can be coerced to strings, the comparison is lexicographic; otherwise is it an error. _e_x_p_r_1 ==== _e_x_p_r_2 Compare the values and produce true if the first value is equal to the second value, false otherwise. If both values can be coerced to numbers, the comparison is numeric; if both values can be coerced to strings, the comparison is lexicographic; otherwise is it an error. _e_x_p_r_1 !!== _e_x_p_r_2 Compare the values and produce true if the first value is not equal to the second value, false otherwise. If both values can be coerced to numbers, the comparison is numeric; if both values can be coerced to strings, the comparison is lexicographic; otherwise is it an error. _e_x_p_r_1 && _e_x_p_r_2 This operation produces the bitwise-and of the two values. Is is an error if the values cannot be coerced to numbers. _e_x_p_r_1 || _e_x_p_r_2 This operation produces the bitwise-or of the two values. Is is an error if the values cannot be coerced to numbers. _e_x_p_r_1 &&&& _e_x_p_r_2 Result is true if both expressions are true. Short circuit evaluation is used, and so _e_x_p_r_2 is not evaluated if _e_x_p_r_1 is false. Is is an error if the arguments cannot be coerced to booleans. Synonym: --AAnndd _e_x_p_r_1 _e_x_p_r_2 Logical and (implied). Result is true if both expressions are true. Short circuit evaluation is used, and so _e_x_p_r_2 is not evaluated if _e_x_p_r_1 is false. Please note that implicit operator plays merry hell with operator precedence, because there is no operator. If you are getting odd results, use explicit operators. _e_x_p_r_1 |||| _e_x_p_r_2 Result is true if either expression is true. Short circuit evaluation is used, and so _e_x_p_r_2 is not evaluated if _e_x_p_r_1 is true. Is is an error if the arguments cannot be coerced to booleans. Synonym: --OOrr _e_x_p_r_1 ?? _e_x_p_r_2 :: _e_x_p_r_3 The value of this expression is _e_x_p_r_2 if _e_x_p_r_1 is true, and _e_x_p_r_3 otherwise. The _e_x_p_r_1 is always evaluated, but only one of _e_x_p_r_2 or _e_x_p_r_3 will be evaluated. It is an error if the value of _e_x_p_r_1 cannot be coerced to boolean. _e_x_p_r_1 ,, _e_x_p_r_2 Both _e_x_p_r_1 and _e_x_p_r_2 are always evaluated. The value of _e_x_p_r_1 is discarded; the value of the expression is the value of _e_x_p_r_2. Operators have precedence as described by the following table, highest to lowest: +----------------------------+ | Operator Direction | +----------------------------+ |_(_u_n_a_r_y_) + - ~ ! <- | |* / % ~ -> | |+ - : -> | |<< >> -> | |< <= > >= -> | |== != -> | |& -> | |^ -> | || -> | |&& -> | ||| -> | |? : -> | |, -> | +----------------------------+ FFUUNNCCTTIIOONNSS There are a number of built-in functions which may be used in the expression. Functions may be invoked using a syntax similar to C functions. _n_a_m_e (( _a_r_g_u_m_e_n_t_s )) You need to leave spaces around the parentheses so that they are separate command line arguments. atime This function may be used to determine the last- accessed-time of a file. It takes one argument. basename This function returns the basename of the string argument passed to it. It takes one argument. ctime This function may be used to determine the last- change-time of an inode. It takes one argument. gid This function may be used to determine the gid of a file. It takes one argument. inode This function may be used to determine the inode number of a file. It takes one argument. mode This function may be used to determine the access mode (permissions) of a file. It takes one argument. mtime This function may be used to determine the last- modified-time of a file. It takes one argument. print This function may be used to print a value. It takes one argument. Always returns true. size This function may be used to determine the size in bytes of a file. It takes one argument. type This function may be used to determine the type of a file. It takes one argument. It returns a string: "block_special", "character_special", "directory", "file", "named_pipe", "socket" or "symbolic_link". uid This function may be used to determine the uid of a file. It takes one argument. TTEESSTTSS Most tests exist to provide compatibility with _f_i_n_d(1). --AAcccceessss__MMiinnuutteess [ _r_e_l_a_t_i_v_e_-_o_p_e_r_a_t_o_r ] _n_u_m_b_e_r True if the current file was accessed exactly _n_u_m_b_e_r minutes ago, false otherwise. If a relative operator is given (<, <=, ==, !=, > or >=) a relative comparison will be made, rather than the implicit equality test. This is _n_o_t identical to the similar _f_i_n_d(1) test. This is shorthand for the ``( now - atime ( {} )) / 60 _r_e_l_a_t_i_v_e_-_o_p_e_r_a_t_o_r _n_u_m_b_e_r'' expression. --AAcccceessss__TTiimmee [ _r_e_l_a_t_i_v_e_-_o_p_e_r_a_t_o_r ] _n_u_m_b_e_r True if the current file was accessed exactly _n_u_m_b_e_r days ago, false otherwise. If a relative operator is given (<, <=, ==, !=, > or >=) a relative comparison will be made, rather than the implicit equality test. This is _n_o_t identical to the similar _f_i_n_d(1) test. This is shorthand for the ``( now - atime ( {} )) / 86400 _r_e_l_a_t_i_v_e_- _o_p_e_r_a_t_o_r _n_u_m_b_e_r'' expression. --CChhaannggee__MMiinnuutteess _n_u_m_b_e_r True if the current file's inode was changed exactly _n_u_m_b_e_r minutes ago, false otherwise. If a relative operator is given (<, <=, ==, !=, > or >=) a relative comparison will be made, rather than the implicit equality test. This is _n_o_t identical to the similar _f_i_n_d(1) test. This is shorthand for the ``( now - ctime ( {} )) / 60 _r_e_l_a_t_i_v_e_-_o_p_e_r_a_t_o_r _n_u_m_b_e_r'' expression. --CChhaannggee__TTiimmee _n_u_m_b_e_r True if the current file's inode was changed exactly _n_u_m_b_e_r days ago, false otherwise. If a relative operator is given (<, <=, ==, !=, > or >=) a relative comparison will be made, rather than the implicit equality test. This is _n_o_t identical to the similar _f_i_n_d(1) test. This is shorthand for the ``( now - ctime ( {} )) / 86400 _r_e_l_a_t_i_v_e_-_o_p_e_r_a_t_o_r _n_u_m_b_e_r'' expression. --MMooddiiffyy__MMiinnuutteess _n_u_m_b_e_r True if the current file was modified exactly _n_u_m_b_e_r minutes ago, false otherwise. If a relative operator is given (<, <=, ==, !=, > or >=) a relative comparison will be made, rather than the implicit equality test. This is _n_o_t identical to the similar _f_i_n_d(1) test. This is shorthand for the ``( now - mtime ( {} )) / 60 _r_e_l_a_t_i_v_e_-_o_p_e_r_a_t_o_r _n_u_m_b_e_r'' expression. --MMooddiiffyy__TTiimmee _n_u_m_b_e_r True if the current file was modified exactly _n_u_m_b_e_r days ago, false otherwise. If a relative operator is given (<, <=, ==, !=, > or >=) a relative comparison will be made, rather than the implicit equality test. This is _n_o_t identical to the similar _f_i_n_d(1) test. This is shorthand for the ``( now - mtime ( {} )) / 86400 _r_e_l_a_t_i_v_e_- _o_p_e_r_a_t_o_r _n_u_m_b_e_r'' expression. --NNeewweerr _f_i_l_e_n_a_m_e True if the current file was modified after the given file. This is shorthand for the ``mtime ( {} ) > mtime ( _f_i_l_e_n_a_m_e )'' expression. --NNaammee _p_a_t_t_e_r_n Base of file name (the path with the leading directories removed) matches shell pattern _p_a_t_t_e_r_n. This is short-hand for the ``_p_a_t_t_e_r_n ~ basename ( {} )'' expression. --PPAAtthh _p_a_t_t_e_r_n File name matches shell pattern _p_a_t_t_e_r_n. Note that the file name if affected by the --rreessoollvvee option. This is short-hand for the ``_p_a_t_t_e_r_n ~ {}'' expression. --TTyyppee _s_t_r_i_n_g The file type matches the type given. This is shorthand for the ``type ( {} ) == _s_t_r_i_n_g'' expression. Type names are matched similar to options: Block The file is a block special file. Character The file is a character special file. Directory The file is a directory. File The file is a normal file. Link The file is a symbolic link. Pipe The file is FIFO (a named pipe). Socket The file is a UNIX domain socket. AACCTTIIOONNSS --pprriinntt This will print the full file name on the standard output, followed by a newline. The --RReessoollvvee option will affect what is printed. This is short-hand for the ``print ( {} )'' expression. EEXXIITT SSTTAATTUUSS The _a_e_f_i_n_d command will exit with a status of 1 on any error. The _a_e_f_i_n_d command will only exit with a status of 0 if there are no errors. EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS See _a_e_g_i_s(1) for a list of environment variables which may affect this command. CCOOPPYYRRIIGGHHTT aefind version .C001 Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Peter Miller; All rights reserved. The aefind program comes with ABSOLUTELY NO WARRANTY; for details use the '_a_e_f_i_n_d _-_V_E_R_S_i_o_n _L_i_c_e_n_s_e' command. This is free software and you are welcome to redistribute it under certain conditions; for details use the '_a_e_f_i_n_d _-_V_E_R_S_i_o_n _L_i_c_e_n_s_e' command. AAUUTTHHOORR Peter Miller E-Mail: millerp@canb.auug.org.au /\/\* WWW: http://www.canb.auug.org.au/~millerp/ Reference Manual Aegis 1