简体   繁体   English

使用STDIN从文件中删除Bash,Cowsay命令

[英]Bash, Cowsay command from file with STDIN

I'm still pretty new Linux so I apologize for that. 我仍然是很新的Linux,为此我深表歉意。 I'm running Fedora, Bash terminal. 我正在运行Bash终端Fedora。

I was wondering if there's a way to use STDIN, to print a Cowsay animation to terminal from a file. 我想知道是否存在使用STDIN的方法来从文件中打印Cowsay动画到终端。

For example, if my file is called newfile.txt and the context is: 例如,如果我的文件名为newfile.txt,上下文为:

cowsay -f tux "Keep going"

What's the correct way to use STDIN to read that command from the file and print it to temrinal? 使用STDIN从文件中读取该命令并将其打印到temrinal的正确方法是什么?

command<newfile.txt

Thanks! 谢谢!

Just do cowsay < <FILE> . 只需执行cowsay < <FILE> Example: 例:

$ echo aoeu > /tmp/FILE
$ cowsay -f tux < /tmp/FILE
 ______
< aoeu >
 ------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

In man cowsay it says: man cowsay说:

If run with no arguments, it accepts standard input 如果不带参数运行,则接受标准输入

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM