Passing parameters to bash when executing a script fetched by curl

前端 未结 3 907
小鲜肉
小鲜肉 2020-12-07 09:18

I know how to execute remote Bash scripts like this:

curl http://example.com/script.sh | bash

or

bash < <( curl http:         


        
3条回答
  •  一个人的身影
    2020-12-07 09:36

    try

    curl http://foo.com/script.sh | bash -s arg1 arg2
    

    bash manual says:

    If the -s option is present, or if no arguments remain after option processing, then commands are read from the standard input. This option allows the positional parameters to be set when invoking an interactive shell.

提交回复
热议问题