【发布时间】:2022-01-18 10:25:04
【问题描述】:
如何在 bash 中使用 only 键盘(不是鼠标)从上一个命令的输出中复制文本
$ ./my_lovely_program input.txt
eggs
sugar
flour
$ <----- any way to move "up" and yank / copy the word "sugar" ?
【问题讨论】:
如何在 bash 中使用 only 键盘(不是鼠标)从上一个命令的输出中复制文本
$ ./my_lovely_program input.txt
eggs
sugar
flour
$ <----- any way to move "up" and yank / copy the word "sugar" ?
【问题讨论】:
一旦打印了一些东西,它就消失了,bash 不再知道它的任何内容。 bash 可以拦截您的击键,但不会将之前的输出存储在任何地方。你能做的最好的就是使用tee:
./my_lovely_program input.txt | tee some_file
some_file 将包含程序的标准输出。
【讨论】: