#!/bin/bash SYSTEM=$1 SYSLIST='systems' shift PARAM="$*" if [ -z "$SYSTEM" ]; then echo Usage: $0 systemname echo Uses the system listing in the file: $SYSLIST exit 1 fi if [ ! -f "$SYSLIST" ]; then echo Missing systems list file $SYSLIST exit 2 fi LINE=`grep ^$SYSTEM $SYSLIST` if [ $? -ne 0 ] || [ -z "$LINE" ]; then echo system \"$SYSTEM\" not found in systems listing file at: $SYSLIST exit 3 fi CMD=`echo $LINE | awk '{print "/opt/pgsql/" $4 "/bin/psql -h " $2 " -p " $3}'` CMD="$CMD $PARAM" echo $CMD #$CMD