将所有的bash输出连接到一个脚本中?

时间:2022-06-08 14:03:30

Here's my issue. I found a hilarious little tool lolcat that I want to prank my friend with.

这是我的问题。我发现了一个有趣的小工具,我想用它来捉弄我的朋友。

Is there any way I can get all bash stdout to pipe thru to the program lolcat?

有没有办法让所有的bash stdout通过管道传输到程序lolcat?

Some examples:

一些例子:

$ git status

When submitted, becomes this command behind the scenes:

提交后,成为幕后的命令:

$ git status | lolcat --force

Basically I want any program output from bash to go thru lolcat.

基本上,我希望bash的任何程序输出都经过lolcat。

I can easily inject the program into a ps1 prompt, but I wanted to one up that and really make it hilarious.

我可以很容易地将程序注入到ps1提示符中,但是我想把它添加到其中并使它变得非常有趣。

Anyone know if this is possible?

有人知道这是否可能吗?

1 个解决方案

#1


2  

You could use the following

您可以使用以下命令

bash | lolcat

However with my minimal testing it shows the ansi escape codes and the prompt isn't colored.

但是,通过我的最小测试,它显示了ansi转义代码,提示符没有着色。

#1


2  

You could use the following

您可以使用以下命令

bash | lolcat

However with my minimal testing it shows the ansi escape codes and the prompt isn't colored.

但是,通过我的最小测试,它显示了ansi转义代码,提示符没有着色。