#!/bin/bash # # Copyright (c) 2020 Bubble, Inc. All rights reserved. For personal (non-commercial) use, see license: https://getbubblenow.com/bubble-license/ # # # List bubble databases # # Usage: # # list_bubble_databases [db-match] # # db-match only list databases whose names include this value. default is bubble # # SCRIPT="${0}" SCRIPT_DIR=$(cd $(dirname ${SCRIPT}) && pwd) DB_USER=$(whoami) DB_BASENAME="${1:-bubble}" echo "select datname from pg_database" | psql -qt -U ${DB_USER} | tr -d ' ' | grep ${DB_BASENAME}