bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

relocatable-prog: Improve verbose output


From: Bruno Haible
Subject: relocatable-prog: Improve verbose output
Date: Sun, 24 Feb 2019 15:18:45 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-141-generic; KDE/5.18.0; x86_64; ; )

The verbose output of the 'install-reloc' script is not copy&paste friendly:
After copy&pasting a logged command, one needs to escape double-quotes, before
running the command from a shell prompt.

Better do this escaping in the script already.

Yes, this will only be an improvement for users who use a Bourne-compatible
shell. But Real Hackers(TM) don't use csh anyway :)


2019-02-24  Bruno Haible  <address@hidden>

        relocatable-prog: Improve verbose output.
        * build-aux/install-reloc (func_verbose): Escape characters that would
        be interpreted by the shell.

diff --git a/build-aux/install-reloc b/build-aux/install-reloc
index e68386e..75c3674 100755
--- a/build-aux/install-reloc
+++ b/build-aux/install-reloc
@@ -208,7 +208,9 @@ fi
 # 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'
   "$@"
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]