diff build-aux/install-reloc @ 40200:19988ebda9fa

relocatable-prog: Improve verbose output. * build-aux/install-reloc (func_verbose): Escape characters that would be interpreted by the shell.
author Bruno Haible <bruno@clisp.org>
date Sun, 24 Feb 2019 15:18:24 +0100
parents 5fd32d128129
children 9e8fb35d4032
line wrap: on
line diff
--- a/build-aux/install-reloc	Sun Feb 24 11:59:48 2019 +0100
+++ b/build-aux/install-reloc	Sun Feb 24 15:18:24 2019 +0100
@@ -208,7 +208,9 @@
 # Outputs a command and runs it.
 func_verbose ()
 {
-  echo "$@"
+  # Make it easy to copy&paste the printed command into a shell in most cases,
+  # by escaping '\\', '"', and '$'. This is not perfect, just good enough.
+  echo "$@" | sed -e 's/\([\\"$]\)/\\\1/g'
   "$@"
 }