使用Bash变量代替文件作为可执行文件的输入 [英] using a Bash variable in place of a file as input for an executable

查看:110
本文介绍了使用Bash变量代替文件作为可执行文件的输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个可执行文件,其使用方式如下:

I have an executable that is used in a way such as the following:

executable -v -i inputFile.txt -o outputFile.eps

为了提高效率,我想使用Bash变量代替输入文件.因此,我想执行以下操作:

In order to be more efficient, I want to use a Bash variable in place of the input file. So, I want to do something like the following:

executable -v -i ["${inputData}"] -o outputFile.eps

在这里,方括号代表一些巧妙的代码.

Here, the square brackets represent some clever code.

您是否知道一些技巧,可以让我以这种方式将信息传递到所描述的可执行文件中?

Do you know of some trick that would allow me to pipe information into the described executable in this way?

非常感谢您的协助

推荐答案

您可以使用该构造

<(command)

让bash使用为您输出的命令创建一个fifo.因此,只需尝试:

to have bash create a fifo with commands output for you. So just try:

-i <(echo "$inputData")

这篇关于使用Bash变量代替文件作为可执行文件的输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆