cmd.sh: I dislike shell escaping, and it doesn't like me either. (fix escaped ')
authorPeter Gervai <grin@grin.hu>
Fri, 04 Mar 2022 11:01:00 +0100
changeset 9 c636ea2e8ee1
parent 8 b92f5cceab78
child 10 aaa61e5b4526
cmd.sh: I dislike shell escaping, and it doesn't like me either. (fix escaped ')
synapse/cmd.sh
--- a/synapse/cmd.sh	Fri Mar 04 10:54:52 2022 +0100
+++ b/synapse/cmd.sh	Fri Mar 04 11:01:00 2022 +0100
@@ -56,13 +56,13 @@
 if [ "$MODE" = "unts" ]; then
 	echo "Creating unts() function; needs write access or you can simply copy the following code into psql."
 	echo " "
-	SQL='CREATE OR REPLACE FUNCTION public.unts(bigint)
+	SQL="CREATE OR REPLACE FUNCTION public.unts(bigint)
  RETURNS timestamp with time zone
  LANGUAGE sql
  IMMUTABLE STRICT
-AS $function$
-  SELECT TIMESTAMP WITH TIME ZONE ''epoch'' + $1/1000 * INTERVAL ''1 second''
-$function$'
+AS \$function$
+  SELECT TIMESTAMP WITH TIME ZONE 'epoch' + \$1/1000 * INTERVAL '1 second'
+\$function$"
 	echo "${SQL}"
 	echo " "
 	$CMD "${SQL}"