是什么造就了 shell "POSIX compliant"?
What makes a shell "POSIX compliant"?
我对 Windows 上的 Shells 的工作方式感到非常厌倦 - 而且,没有那么多选择。所以我考虑过只写我自己的 shell。然而,在阅读一些关于 autotools 生成的脚本的文档时,我注意到有时会使用“SH 兼容”或“POSIX 类兼容 shell”。
据我所知,例如,Bash 脚本与 Fish 不兼容,因为 &&
被文字 and
取代 - 这只是我能发现的一个区别一目了然。
那么什么 shell 需要“符合 SH”或“POSIX-like 兼容 shell”?除了读取要执行的命令和存储一些变量之外, shell 并没有真正做很多事情,所以我认为它只是语法上的。或者,我错了吗?
So what would a shell need to be "SH compliant" or "POSIX-like compliant shell"?
对于与 shell 行为相关的文档,需要遵循 POSIX standards. POSIX is an open standard - you can read it online at https://pubs.opengroup.org/onlinepubs/9699919799/ . See section Shell & Utilities 2. Shell Command Language 指定的行为。
没有(至少我不知道)认证公司可以将特定 shell 程序认证为“POSIX 合规”。整个操作系统都在 POSIX-certified,然后这些操作系统带有 POSIX 兼容的 shell。在没有足够资金获得外部公司认证的项目的情况下,作者通常会说他的创作是否旨在 POSIX 兼容,如果他这样做, 那么用户期望 shell 的行为与 POSIX.
指定的一样
Bash scripts are incompatible with Fish for instance
来自bash manual:
It is intended to be a conformant implementation of the IEEE POSIX Shell and Tools portion of the IEEE POSIX specification (IEEE Standard 1003.1).
Unlike other shells, fish does not follow the POSIX standard, but still uses roughly the same model.
我对 Windows 上的 Shells 的工作方式感到非常厌倦 - 而且,没有那么多选择。所以我考虑过只写我自己的 shell。然而,在阅读一些关于 autotools 生成的脚本的文档时,我注意到有时会使用“SH 兼容”或“POSIX 类兼容 shell”。
据我所知,例如,Bash 脚本与 Fish 不兼容,因为 &&
被文字 and
取代 - 这只是我能发现的一个区别一目了然。
那么什么 shell 需要“符合 SH”或“POSIX-like 兼容 shell”?除了读取要执行的命令和存储一些变量之外, shell 并没有真正做很多事情,所以我认为它只是语法上的。或者,我错了吗?
So what would a shell need to be "SH compliant" or "POSIX-like compliant shell"?
对于与 shell 行为相关的文档,需要遵循 POSIX standards. POSIX is an open standard - you can read it online at https://pubs.opengroup.org/onlinepubs/9699919799/ . See section Shell & Utilities 2. Shell Command Language 指定的行为。
没有(至少我不知道)认证公司可以将特定 shell 程序认证为“POSIX 合规”。整个操作系统都在 POSIX-certified,然后这些操作系统带有 POSIX 兼容的 shell。在没有足够资金获得外部公司认证的项目的情况下,作者通常会说他的创作是否旨在 POSIX 兼容,如果他这样做, 那么用户期望 shell 的行为与 POSIX.
指定的一样Bash scripts are incompatible with Fish for instance
来自bash manual:
It is intended to be a conformant implementation of the IEEE POSIX Shell and Tools portion of the IEEE POSIX specification (IEEE Standard 1003.1).
Unlike other shells, fish does not follow the POSIX standard, but still uses roughly the same model.