相关疑难解决方法(0)

unix shell 脚本的文件扩展名

在维基百科上,.sh的文章说:

有关 .sh 文件扩展名类型,请参阅Bourne shell

其他unix shell怎么样?

我知道在文件中 使用shebang来指示要执行的解释器,但我想知道:

  • 文件扩展名与无文件扩展名的优缺点是什么?

scripting conventions shell-script filenames files

54
推荐指数
5
解决办法
12万
查看次数

bash 脚本使用 .sh 或 .bash 扩展名?

(有关Ubuntu-OSX 兼容性和易用性以及 POSIX,请参阅使用 #!/bin/sh 或 #!/bin/bash

如果我希望我的脚本使用 bash shell,那么使用 .bash 扩展名实际上是调用 bash 还是依赖于系统配置/第一个 shebang 行。如果两者都有效但不同,哪个优先?

我不确定是否用 .sh 结束我的脚本以仅指示“shell 脚本”,然后让第一行选择 bash shell(例如#!/usr/bin/env bash),或者是否只用 .bash 结束它们(以及第 1 行设置) )。我想调用 bash。

shell bash shebang

39
推荐指数
2
解决办法
6万
查看次数

标签 统计

bash ×1

conventions ×1

filenames ×1

files ×1

scripting ×1

shebang ×1

shell ×1

shell-script ×1