Familiar with the following?
You are aware of (shell)file which contains a interesting line and you think: “I want to execute this line on the command prompt”. Most people will do the following:
% more <file>
[select interesting bit with your mouse]
[paste]<enter>
And the code gets executed.
I propose the following function: f(), which does the following:
- It opens the file in $EDITOR (:=
vimof course); - You delete everything you don’t want to execute;
- What’s left gets executed;
- And it is added to your shell’s history.
The code of the function looks like this: