#!/bin/bash echo 'Provide the site name (e.g. your-awesome-site), then press [ENTER]:'; read -r SITE; echo 'Provide the environment name (multidev, dev, test, or live), then press [ENTER]:'; read -r ENV; # Get a list of all cache tables CACHETABLES="$(terminus drush "$SITE"."$ENV" -- sql:query "SHOW TABLES LIKE 'cache%';")" # Truncate each cache table in a loop to avoid resource contention and potential deadlocks. for table in $CACHETABLES; do terminus drush "$SITE"."$ENV" -- sql:query "TRUNCATE TABLE $table;" done