I'm trying to use the following in a shell (/bin/sh) script but I keep getting errors:
su postgres -c "/usr/bin/psql -c \'CREATE ROLE user WITH SUPERUSER LOGIN PASSWORD \'$password;"
It seems that something with the quoting is wrong, but I can't find what is it. I should pass the variable $password and the command as postgres user. Can someone help me?
Thanks in advance