Friday, January 28, 2011

Using dot (.) as delimiter to specify group in chown

I've always done:

chown nimmylebby:admins file

I see that this also works:

chown nimmylebby.admins file

Might seem like a silly question but I'm genuinely curious on how the latter works. It isn't documented in my chown's manpage (GNU coreutils 8.4, 10/10). Is this perhaps a Bash interpretation? Or a deprecated format for the argument?

  • Hi,

    from the chown(8) manpage on macos x 10.6.4.

    COMPATIBILITY
         Previous versions of the chown utility used the dot (``.'') character to distin-
         guish the group name.  This has been changed to be a colon (``:'') character, so
         that user and group names may contain the dot character.
    

    Good question, I learned something today ;)

    From nayden
  • From info coreutils 'chown invocation' for GNU coreutils:

    Some older scripts may still use '.' in place of the ':' separator. POSIX 1003.1-2001 (*note Standards conformance::) does not require support for that, but for backward compatibility GNU 'chown' supports '.' so long as no ambiguity results. New scripts should avoid the use of '.' because it is not portable, and because it has undesirable results if the entire OWNER'.'GROUP happens to identify a user whose name contains '.'.

0 comments:

Post a Comment