无法使用 sh <file_name> 执行脚本

use*_*987 0 scripts sh

我无法使用 sh file_name 执行脚本但是它可以正常使用命令:./filename

阿迪提亚

xen*_*oid 7

在 Ubuntu 上,sh(或更准确地说,/bin/sh)是“破折号”而不是“bash”。当您使用时,sh {filename}您会强制脚本由dash. 当您使用./filename脚本时,“shebang”(#!...在第一行)所说的任何内容都会被解释,这通常是为(bash可能)编写脚本的解释器。