MJN All Blog Cheatsheets Elasticsearch GCP JS LinuxBash Misc Notes Other ShortcutKeys / - Search

Home / LinuxBash / Script pg - Connect to postgresql using psql


#!/bin/bash
help_text="
NAME
  pg - Connect to postgresql using psql.

USAGE
  pg [options] <parameters>

OPTIONS
  -x
    Description...

  -h|--help
    Show help text.

DESCRIPTION
  Connect to postgresql using psql.

AUTHOR
  mjnurse.dev - 2020
"
help_line="Connect to postgresql using psql"
web_desc_line="Connect to postgresql using psql"

export PGPASSWORD=postgres

wp=""
if [[ "$GITBASH" == "Y" ]]; then
   wp=winpty
fi

if [[ "$1" == "" ]]; then
   $wp psql --host=localhost -d postgres -U postgres 
else
   $wp psql --host=localhost -d postgres -U postgres -f $1
fi

This page was generated by GitHub Pages. Page last modified: 25/04/15 17:09