Skip to content

Instantly share code, notes, and snippets.

@nmenag
Created November 17, 2020 20:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nmenag/8f10333723be3b343cb4debddcd686d2 to your computer and use it in GitHub Desktop.
Save nmenag/8f10333723be3b343cb4debddcd686d2 to your computer and use it in GitHub Desktop.
Drop multiples databases Postgres
psql -h localhost -U postgres -d postgres -c "copy (select datname from pg_database where datname like '%nominapp_api%') to stdout" | while read line; do
echo "$line"
dropdb -i "$line"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment