Skip to content

Instantly share code, notes, and snippets.

View horkko's full-sized avatar

Emmanuel Quevillon horkko

View GitHub Profile
@horkko
horkko / psql_to_csv.sh
Created August 23, 2017 08:02 — forked from sharmaeklavya2/psql_to_csv.sh
Export all tables in a postgres database to a set of CSV files
#!/bin/bash
DB_NAME="$USER"
DBMS_SHELL="psql"
#if [ "$1" = '--help' ]; then
if [[ ( "$1" == '--help' ) || ( "$1" == '-h' ) ]]; then
echo "usage: $0 [DB_NAME] [DBMS_SHELL]"
echo "default DB_NAME is your username"
echo "default DBMS_SHELL is 'psql'"