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.
#!/bin/bash
#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
PURPLE=’\033[0;35m’
NC=’\033[0m’ # No Color
echo -e “${PURPLE} FOUND IT! ${NC}\n”
fi
Posted on Github for better formatting. You are welcome.

Comments

Popular posts from this blog

Postgres on Synology

The Making of Basculo

Build an independent watch app - PART IV