且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在 Bash 中重用上一个命令的输出

更新时间:2023-01-21 19:37:08

您可以使用 $(!!)重新计算(不是重复使用)最后一个命令的输出.

You can use $(!!) to recompute (not re-use) the output of the last command.

!! 自己执行最后一个命令.

The !! on its own executes the last command.

$ echo pierre
pierre
$ echo my name is $(!!)
echo my name is $(echo pierre)
my name is pierre