为什么有一个 '.' 在重庆工作?

Eva*_*oll 3 gnu coreutils history chown

为什么 GNUchown user.group有效?文档没有说明所支持的语法。背后有什么动人的故事吗?

Ark*_*zyk 7

info chown 很清楚:

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 `.'.
Run Code Online (Sandbox Code Playgroud)

GNU程序的情况下,通常不仅值得检查,man而且info页面也值得检查,因为GNU 人憎恶手册页(来自man tar)。

  • 重要的历史背景:当 `chown` 第一次获得在单个命令中执行 user 和 group 的能力时(4.3BSD 是我能找到的最早的这样的例子),人们并没有做疯狂的事情,比如在他们的用户名中加点。点、破折号、大写字母、超过 8 个字符的长度……都是不可想象的。此外,冒号是一个可以避免将来允许用户名组增长的字符,因为它是 `/etc/passwd` 中的分隔符 (2认同)