From 87e90832fd91b7314336d770c67c3879244f8c13 Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc kop@karlpinc.com" Date: Sat, 8 Feb 2025 00:02:43 +0000 Subject: [PATCH] Only set user when we have the final user & clean up variable names --- bin/sokwedb-user-add.m4 | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/bin/sokwedb-user-add.m4 b/bin/sokwedb-user-add.m4 index 80d1fc3..2575a1a 100644 --- a/bin/sokwedb-user-add.m4 +++ b/bin/sokwedb-user-add.m4 @@ -50,32 +50,31 @@ export CONNECTIONSTRING='sslmode=require' export ADMIN='' export DEV='' export AZURE='yes' -export HOSTARGS='' -export A_ADMINUSER=$1 -while [ "$A_ADMINUSER" = '-a' \ - -o "$A_ADMINUSER" = '-d' \ - -o "$A_ADMINUSER" = '--no-azure' \ - -o "$A_ADMINUSER" = '-h' \ - -o "$A_ADMINUSER" = '--help' ] ; do - if [ "$A_ADMINUSER" = '-a' ] ; then +export FIRSTARG=$1 +while [ "$FIRSTARG" = '-a' \ + -o "$FIRSTARG" = '-d' \ + -o "$FIRSTARG" = '--no-azure' \ + -o "$FIRSTARG" = '-h' \ + -o "$FIRSTARG" = '--help' ] ; do + if [ "$FIRSTARG" = '-a' ] ; then ADMIN='-a' shift - elif [ "$A_ADMINUSER" = '-d' ] ; then + elif [ "$FIRSTARG" = '-d' ] ; then DEV='-d' shift - elif [ "$A_ADMINUSER" = '--no-azure' ] ; then + elif [ "$FIRSTARG" = '--no-azure' ] ; then AZURE="no" shift - elif [ "$A_ADMINUSER" = '-h' ] ; then + elif [ "$FIRSTARG" = '-h' ] ; then CONNECTIONSTRING="$CONNECTIONSTRING host=$2" shift 2 - elif [ "$A_ADMINUSER" = '--help' ] ; then + elif [ "$FIRSTARG" = '--help' ] ; then usage exit 0 fi - A_ADMINUSER=$1 - CONNECTIONSTRING="$CONNECTIONSTRING user=$1" + FIRSTARG=$1 done +CONNECTIONSTRING="$CONNECTIONSTRING user=$FIRSTARG" export A_USER=$2 export A_GROUP=$3 -- 2.34.1