From 816fdb8d9bb66a758d302e02c320eeab7f2c66f8 Mon Sep 17 00:00:00 2001 From: MorganGeek Date: Mon, 13 Jul 2020 16:17:33 +0200 Subject: [PATCH] helpers for capturing command outputs --- dot_zsh_functions | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dot_zsh_functions b/dot_zsh_functions index dc9e987..0d02973 100644 --- a/dot_zsh_functions +++ b/dot_zsh_functions @@ -455,6 +455,12 @@ function rssadd() { newsboat } +# Via https://stackoverflow.com/a/58598185/2309958 +# capture the output of a command so it can be retrieved with ret +function cap () { tee /tmp/capture.out} +# return the output of the most recent command that was captured by cap +function ret () { \cat /tmp/capture.out } + # Package / Dependencies management helpers function adhocbis() { local ansible_output=$(adhoc "$*")