Bash,带有 STDIN 的文件中的 Cowsay 命令

Bash, Cowsay command from file with STDIN

我还是个新手 Linux 所以我很抱歉。我是 运行 Fedora,Bash 终端。

我想知道是否有办法使用 STDIN 从文件中将 Cowsay 动画打印到终端。

例如,如果我的文件名为 newfile.txt 并且上下文是:

cowsay -f tux "Keep going"

使用 STDIN 从文件中读取该命令并将其打印到 temrinal 的正确方法是什么?

command<newfile.txt

谢谢!

就做cowsay < <FILE>。示例:

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

man cowsay 中说:

If run with no arguments, it accepts standard input