From 2fcdf3825b78b13d114c9ad0282f3008e45c98fb Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Fri, 17 Jun 2011 13:19:46 +0200 Subject: [PATCH] safer way to check for database existence Signed-off-by: Steven Armstrong --- conf/type/__postgres_database/explorer/state | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/type/__postgres_database/explorer/state b/conf/type/__postgres_database/explorer/state index 565c8a63..dc9659e2 100755 --- a/conf/type/__postgres_database/explorer/state +++ b/conf/type/__postgres_database/explorer/state @@ -20,7 +20,7 @@ name="$__object_id" -if su - postgres -c "psql -l | grep -q '^ *$name'"; then +if su - postgres -c "echo '\q' | psql '$name'" 2>/dev/null; then echo "present" else echo "absent"