in reply to Linux Show Permissions: traverse file access
grep { s/user::/USER:$o:/} @A; # make native Linux dir/file permis +sions uppercase grep { s/group::/GROUP:$g:/} @A; # idem grep { s/other::/OTHER::/} @A; # idem
That is usually written as:
s/user::/USER:$o:/ for @A; # make native Linux dir/file permission +s uppercase s/group::/GROUP:$g:/ for @A; # idem s/other::/OTHER::/ for @A; # idem
$P{$k} =~ s/(?:user|group):[\s\S]*\K(other:.*)//mi;
[\s\S]* could also be written as (?s:.*) and the /m modifier is only useful if the anchors ^ or $ are used.
$P{$k} =~ s/[\n\r\s]+/ /g; # remove newlines
The \s character class includes the characters \n and \r so that could be simplified to $P{$k} =~ s/\s+/ /g;.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Linux Show Permissions: traverse file access
by FreeBeerReekingMonk (Deacon) on Oct 20, 2025 at 18:36 UTC | |
by jwkrahn (Abbot) on Oct 21, 2025 at 04:17 UTC |