【发布时间】:2016-01-01 23:38:01
【问题描述】:
我正在编写一个脚本,我希望它从 Bourne shell 开始。据我了解,启动脚本:
#! /bin/sh
并不总是指定 Bourne shell,而是指定操作系统链接到 /bin/sh 的任何内容。有没有办法明确指定 Bourne?
谢谢!
【问题讨论】:
-
你的意思是像'#!/bin/bash'这样的东西吗?见here
-
感谢您的评论,但我实际上特别不想要 Bash。我需要专门使用 Bourne shell。
-
好吧,正如您在问题中所说,这会改变系统,因此您也必须在脚本中进行更改,大部分时间它指向
bash -
如果我系统上的
#!/bin/sh指向 bash,我就无法强制使用 bourne 而不是 bash? -
hashbang 始终是特定路径;一般来说,您不能指定外壳。
标签: bash shell unix scripting sh