yeg*_*gle 14 file-command history
当我阅读时,file(1)
我在手册页中注意到了这一点(强调我的):
将本地定义添加到 /etc/magic 时,请确保保留这些关键字。用户依赖于知道目录中的所有可读文件都印有“文本”一词。不要像伯克利那样将“shell 命令文本”更改为“shell 脚本”。
这句话背后有什么故事?我猜Berkeley
是指,BSD (Berkeley software distribution)
但谷歌没有提供足够的信息。
链接到file(1)
http://man7.org/linux/man-pages/man1/file.1.html
一些挖掘表明该声明是在 27 年前添加的链接
Don't do as one computer vendor did \- change ``shell commands text''
to ``shell script''.
Run Code Online (Sandbox Code Playgroud)
后来改为当前声明链接
Don't do as Berkeley did \- change ``shell commands text''
Run Code Online (Sandbox Code Playgroud)
人们一直在编写脚本(也可能是 C 程序)来file
在文件上运行,使用$(file foobar)
或捕获输出popen()
,并进行字符串匹配检查以查看输出中是否file
包含(或以)“文本”一词。然后 Berkeley Software Distribution(位于加州大学伯克利分校)的开发人员按照描述进行操作,导致所有这些脚本和程序
无法将 shell 脚本文件识别为文本文件。