相关疑难解决方法(0)

在执行curl提取的脚本时将参数传递给bash

我知道如何通过以下语法执行远程bash脚本:

curl http://foo.com/script.sh | bash
Run Code Online (Sandbox Code Playgroud)

要么

bash < <( curl http://foo.com/script.sh )
Run Code Online (Sandbox Code Playgroud)

这给出了相同的结果.

但是如果我需要将参数传递给bash脚本呢?脚本在本地保存时可能:

./script.sh argument1 argument2
Run Code Online (Sandbox Code Playgroud)

我试过这样的几种可能性,没有成功:

bash < <( curl http://foo.com/script.sh ) argument1 argument2
Run Code Online (Sandbox Code Playgroud)

bash curl argument-passing

48
推荐指数
3
解决办法
2万
查看次数

标签 统计

argument-passing ×1

bash ×1

curl ×1