I do want to run a SQL command which is stores in a bash variable via ssh postgres@hostname psql dbname -c SQL_COMMAND.
Considering that the SQL command has strings in it, what is the proper way of running this, so it is properly escaped?
Example: SQL_COMMAND="SELECT 'aaa'"
I am looking for a solution that takes care of the escaping, so I can easily run other SQL commands without having to escape them myself.