Wrapper to log stdout and stderr of command run for quick reuse. Useful while developing shell pipelines with long-running commands and for rich command history.

Pi a4ea83d0f9 add missing test files 1 month ago
helpers b412cc0476 preview up to 3 pages 1 month ago
rc 434262f605 add tests and disable socat as capturing command run with sudo is not working 1 month ago
tests a4ea83d0f9 add missing test files 1 month ago
README.md 95a984a5b0 update readme and examples 1 month ago
capture.sh 09ecdd31fd rename pty var 1 month ago
recall.sh 17194f55cb add test cases and fail fast if no such prog to recall 1 month ago

README.md

Recall

  • capture - Save stdout and stderr for every command
  • recall - Reuse stdout for pipeline or otherwise

Examples

I do a find with copious output...

capture find . # stderr and stdout are saved to file and printed to console as usual

Forgot to pipe to less...

recall find | less # pipe last captured output from `find` command to `less`

Now I want to test my grep...

recall find | grep 'pattern' # no-need to run find again, only need the output

Original find command had non-zero exit status due to partial failures...

recall -z find | if [ "$?" == "0" ]; then grep 'pattern'; fi  # suppress error

With aliases in .zshrc and .shrc...

+ find .
@ find | less
@ find | grep 'pattern'

I want to build a complex pipeline with many long running commands...

+ find | + grep 'pattern' | + cut -d '/' -f2  # initial attempt
@ find | + grep 'pattern2' | + cut -d '/' -f2 # ok, grep pattern is right
@ find | @ grep | + cut -d'/' -f2             # good to go

# run full pipeline
find . | grep 'pattern2' | cut -d '/' -f2

I want to see all the captured commands...

@ -l

I want to see only the last 30 captured find commands...

@ -l -n 30 find