#!/bin/bash -e # -e Causes bash script to exit if any of the steps # return with a non-zero return value. if [[ $EUID -ne 0 ]]; then echo "Please run as root user." exit 1 fi getStorDirFromDatabase() { DATABASE_NAME="$1" # here-doc to execute this block as postgres user result=`su postgres <