diff --git a/map/osm/import.sh b/map/osm/import.sh index 289bbae3..7d654421 100755 --- a/map/osm/import.sh +++ b/map/osm/import.sh @@ -44,7 +44,7 @@ echo "Start creation of user and initialization of credentials ..." sudo -u postgres psql -c "CREATE USER \"${user}\" PASSWORD '${password}';" sudo -u postgres psql -c "GRANT ALL ON DATABASE \"${database}\" TO \"${user}\";" passphrase="localhost:5432:${database}:${user}:${password}" -if [ ! -e ~/.pgpass ] || [ `less ~/.pgpass | grep -c "$passphrase"` -eq 0 ] +if ! grep -q -s "$passphrase" ~/.pgpass then echo "$passphrase" >> ~/.pgpass chmod 0600 ~/.pgpass diff --git a/map/samples/import.sh b/map/samples/import.sh index affde30f..cefb054c 100644 --- a/map/samples/import.sh +++ b/map/samples/import.sh @@ -40,7 +40,7 @@ echo "Start creation of user and initialization of credentials ..." sudo -u postgres psql -c "CREATE USER ${user} PASSWORD '${password}';" sudo -u postgres psql -c "GRANT ALL ON DATABASE ${database} TO ${user};" passphrase="localhost:5432:${database}:${user}:${password}" -if [ ! -e ~/.pgpass ] || [ `less ~/.pgpass | grep -c "$passphrase"` -eq 0 ] +if ! grep -q -s "$passphrase" ~/.pgpass then echo "$passphrase" >> ~/.pgpass chmod 0600 ~/.pgpass