グループ権限を使用したファイルの検索

グループ権限を使用したファイルの検索

グループ権限を使用してファイルを検索する必要がある場合は、次のコマンドを使用します。

echo **/*(AIE)

AIEは読み取り/書き込み/実行を示します。

所有者およびグループ権限の場合、使用される修飾子はそれぞれ rwx および RWX です。
AIEを使用するアイデアは何ですか?

ベストアンサー1

例コマンドパラメータ

echo **/*(AIE)

zshたとえば、;を使用するグローバル構文
は機能しません。bash

の文字は()グローバル修飾子です。複数の修飾子は論理的に結合されますAND。つまり、すべて適用する必要があります。

したがって、上記のコマンドは、読み取り可能、書き込み可能、​​実行可能ファイル名のセットを示しています。によって設定された権限がありますchmod g+rwx


権限でファイルを検索するより移植性の高い方法は、次の-permテストを使用することです。find

find -perm -g=rwx 

シェルとは独立して動作することに加えて、構文を読みやすくします。


からman zshall

Glob Qualifiers
    Patterns used for filename generation  may  end  in  a  list  of  qualifiers
    enclosed in parentheses.  The qualifiers specify which filenames that other‐
    wise match the given pattern will be inserted in the argument list.

    If the option BARE_GLOB_QUAL is set, then a trailing set of parentheses con‐
    taining no `|' or `(' characters (or `~' if it is special) is taken as a set
    of glob qualifiers.  A glob subexpression that would normally  be  taken  as
    glob  qualifiers, for example `(^x)', can be forced to be treated as part of
    the glob pattern  by  doubling  the  parentheses,  in  this  case  producing
    `((^x))'.

    If  the  option EXTENDED_GLOB is set, a different syntax for glob qualifiers
    is available, namely `(#qx)' where x is any of the same glob qualifiers used
    in  the  other  format.   The qualifiers must still appear at the end of the
    pattern.  However, with this syntax multiple glob qualifiers may be  chained
    together.   They  are  treated  as  a  logical AND of the individual sets of
    flags. [...]

    [ ... ]

    A      group-readable files (0040)
    I      group-writable files (0020)
    E      group-executable files (0010)
    R      world-readable files (0004)
    W      world-writable files (0002)
    X      world-executable files (0001)

を参照してman zshall | less '+/Glob Qualifiers'ください。pinfo zsh

おすすめ記事