How can I treat the output of a command as a file?

醉酒当歌 提交于 2019-12-23 21:28:58

问题


The whiptail command has an option --textbox that has the following description:

--textbox <file> <height> <width>

The first option requires a file as input; I would like to use the output of a command in its place. It seems like this should be possible in bash - possibly with redirection? For the sake of the question, let's say I'd like to view the output of ls -l in a whiptail textbox.

Update

It looks like the marked answer does answer the question I asked, just not as regards to whiptail. For example, cat <(ls -l) works. Hence I will mark the question as answered, even though the specific example of whiptail does not work with process substitution.


回答1:


You can use this process substitution syntax:

--textbox <(command) 600 800

Replace command with your custom command.




回答2:


Does this meet your needs? ls -l > my_file whiptail --textbox my_file



来源:https://stackoverflow.com/questions/23089426/how-can-i-treat-the-output-of-a-command-as-a-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!