notes/scripts/psql-d
2024-09-10 07:06:40 -07:00

21 lines
307 B
Bash
Executable file

#!/usr/bin/env bash
#
printhelp() {
cat <<EOM
Usage psql-d DOCKER_PORT DATABASE_NAME USER_NAME
Example:
psql-d 5936 app_db admin
NOTE: password needed
EOM
exit 0
}
if [[ $# -lt 1 ]]; then
printhelp
fi
PORT=$1
DB_NAME=$2
USER_NAME=$3
psql -U "$USER_NAME" -h localhost -p "$PORT" -d "$DB_NAME"