设想:
你每天都在做 Bash shell 的事情。你想运行之前的命令,所以你输入:
history | grep foocommand
然后你会得到一份foocommand
你所做的所有事情的列表,不管你的历史记录了多久,在这样的列表中:
585 foocommand --baz --bleet
750 foocommand | grep quux
987 history grep | foocommand
你决定要运行命令 585,所以你输入
!585
问题:只是出于好奇,有没有办法将最后一步排除在等式之外并仍然获得预期的结果?如果有办法说:
"grep through history and automatically run the first item on the list"
或者
"grep through history and let me choose which item to run using the arrow keys"