如何将一个变量的值传递给一个命令的标准输入? [英] How to pass the value of a variable to the stdin of a command?
本文介绍了如何将一个变量的值传递给一个命令的标准输入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在写一个shell脚本,应该有点安全,即通过命令和preferably参数没有通过安全数据不使用临时文件。我怎么能传递一个变量到命令的标准输入?或者,如果它是不可能的,如何正确使用临时文件这样的任务呢?
I'm writing a shell script that should be somewhat secure i.e. does not pass secure data through parameters of commands and preferably does not use temporary files. How can I pass a variable to the stdin of a command? Or, if it's not possible, how to correctly use temporary files for such task?
推荐答案
事情就这么简单:
echo "$blah" | my_cmd
这篇关于如何将一个变量的值传递给一个命令的标准输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文