jookyboi of Team Cacher
7/9/2018 - 2:06 PM

Run Cacher snippet contents through bash commands

Suppose that you have a set of commands you need to run on the machine of every new engineer. These commands install Homebrew and wget. You could write a snippet file with the content:

echo "Running setup commands ..."

echo "Installing Homebrew ..."
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

echo "Installing wget ..."
brew install wget

Save the snippet as public, then click on the View Raw link in the snippet file's header. From the browser page that opens, copy the URL to the snippet file.

Then curl the file contents into bash to run the commands:

\curl -sSL https://api.cacher.io/raw/d87125a90faaf53b24bf/8f84e8dce35880bd3bbc/setup.sh | bash