简体   繁体   English

在执行执行脚本的管道中,如何将参数传递给bash

[英]How can I pass parameter into bash while scripts it executes are piped in

What I meant is when I am executing bash scripts using this kind of formart: 我的意思是当我使用这种formart执行bash脚本时:

bash < <( curl http://rvm.io/releases/rvm-install-head )

or 要么

curl http://rvm.io/releases/rvm-install-head | bash

How can I pass in extra parameters along with this execution? 如何在执行过程中传递额外的参数?

Thanks 谢谢

Add parameters after -s switch. -s切换后添加参数。

Example of use: 使用示例:

echo 'echo params count: ${#@}, params: $@' | bash -s param1 param2

Output: 输出:

params count: 2, params: param1 param2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将当前时间戳连接到bash上的管道输入? - How can I concatenate the current timestamp to a piped input on bash? 如何将bash函数的参数扩展为一系列管道命令? - How can I expand arguments to a bash function into a chain of piped commands? echo输出-b参数在bash脚本中。 我怎么能阻止这个? - echo outputs -e parameter in bash scripts. How can I prevent this? 如何在不更改脚本的情况下在 bash 脚本中使用别名? - How can I use aliases in bash scripts without changing the scripts? 如何在将通过管道输出的函数的bash上设置环境变量? - How can I set an environment variable on bash on a function whose output will be piped? 将参数传递给bash脚本并在Chef Cookbook中调用bash脚本 - Pass parameter to bash script and call bash scripts in Chef cookbook 如何将空变量传递给bash函数并将其实际计为参数? - How can I pass an empty variable to a bash function and have it actually count it as a parameter? 如何将正则表达式作为参数传递给 Bash 脚本中的 Perl one-liner? - How can I pass a regular expression as a parameter to a Perl one-liner in a Bash script? 如何在bash脚本中将变量传递到命令的参数上? - How can I pass a variable onto a command's parameter in a bash script? 在bash中如何从tee管道的函数中退出脚本? - In bash how do I exit a script from a function that is piped by tee?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM