Get output from a previous bash command

I was trying to hack something to send me a notification when a Testflight build had done its processing. And I ran into the realization that I didn’t know how to retrieve the output of the previous command that is watching the build.
I managed to make it work and so I am sharing for the next person that is running into this type of problem and doesn’t want to scrap a dozen Stackoverflow posts.
#remember that Bash is finicky and that spacing is a big deal.
# execute a command
output=`ls .` . #thos are back quotes
echo $output
# grep for when the word json occurs
ret=` grep “firebase_postman.json” <<< “$output” `
echo $ret
if [ “$ret” == “firebase_postman.json” ]; then
NC=’\033[0m’ # No Color
echo -e “${PURPLE} FOUND IT! ${NC}\n”
Posted on Github for better formatting. You are welcome.


Popular posts from this blog

Bring Boxee Box back to life

Postgres on Synology

Zen-inification - The art of decluttering