I often use find
or locate
to find out about paths.
(~) locate foobar.mmpz
/home/progo/lmms/projects/foobar.mmpz
The next step is often to open or otherwise manipulate the files. In a happy case like above, I can do this:
(~) ls `!!`
ls `locate foobar.mmpz`
/home/progo/lmms/projects/foobar.mmpz
But nobody's too happy when there are many lines of output, some of which may not be paths or something else of that kind. Besides, rerunning potentially wasteful commands is not that elegant either.
Would there be a way to hook up zsh to store the stdout into an array for later manipulation? After all, it's the shell's job to redirect the streams to the user. I'm thinking it could store the first N and last N lines in a variable for immediate later use, like $?
and others.
Ok so this is pretty cool: https://unix.stackexchange.com/a/59704/5674. I'm now asking about the zsh know-how (and porting the code to zsh) to rig this kind of capture after each run line.
screen
orscript
and precmd and preexec hooks. – Stéphane Chazelas Feb 27 '14 at 10:09