Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
# -*- sh -*-我最近在一个带有别名的文件顶部遇到了这个问题。它是某人的 bash 目录中的点文件的一部分,直到现在,我以前从未见过它。那么,这是什么?它与使用 shebang 有何不同?我尝试在谷歌上搜索 shebang 的替代品,但没有想出任何可以让我知道上面是什么的提示。
# -*- sh -*-
具有别名定义的文件不需要shebang 行,因为单独执行它们不会将定义添加到当前shell,这是别名定义的点。
相反,必须获取具有别名定义的文件(在当前shell的上下文中运行,使用sourceor .)。
source
.
因此,您所看到的只是一个普通的注释,它表明sh该文件的设计来源是哪个特定的 shell ( )。
sh