On 20/06/2025 16:20, Sam Edge via Cygwin wrote:
On 20/06/2025 13:15, Sebastian Feld via Cygwin wrote:Does Cygwin or POSIX have a tool to test whether a file is owned by a specific group?Win32, like Linux and POSIX, has the concept that files have an owner,and a group (ref:https://learn.microsoft.com/en-us/windows/win32/api/ aclapi/nf-aclapi-getsecurityinfo).How can I test whether a file is owned by a given group name, or not? /usr/bin/test -g and -G do not help because they only look and gid, egid. But I want to pass the group's name as an argument. SebiGroup name: stat -c %G <file> Group ID: stat -c %g <file>
Sorry, so: [ "$(stat -c %G myfile)" = mygroup ] will return true (i.e. $? zero) if myfile is owned by mygroup. -- Sam Edge
OpenPGP_0x8AC2CEBF54528E30.asc
Description: OpenPGP public key
OpenPGP_signature.asc
Description: OpenPGP digital signature
-- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple