$ ksh -c 'trap "" CONT; trap'
trap --  CONT

That is not "suitable for re-entry into the shell". Empty words must be quoted, or they disappear. Expected output:

trap -- '' CONT

Patch below. OK?

- M.

Index: misc.c
===================================================================
RCS file: /cvs/src/bin/ksh/misc.c,v
retrieving revision 1.70
diff -u -p -r1.70 misc.c
--- misc.c      9 Apr 2018 17:53:36 -0000       1.70
+++ misc.c      14 Apr 2018 22:44:39 -0000
@@ -966,6 +966,12 @@ print_value_quoted(const char *s)
        const char *p;
        int inquote = 0;

+       /* Check for empty */
+       if (!*p) {
+               shprintf("''");
+               return;
+       }
+
        /* Test if any quotes are needed */
        for (p = s; *p; p++)
                if (ctype(*p, C_QUOTE))

Reply via email to