freebsd-dev/bin/sh/tests/execution/set-x4.0
Jilles Tjoelker 88ef06f3a9 sh: Make sure output suitable as shell input is also printable.
Commands like 'export -p', 'set' and 'trap', and tracing enabled via 'set
-x' generate output suitable as shell input by adding quotes as necessary.

If there are control characters other than newline or invalid UTF-8
sequences, use $'...' and \OOO to display them safely.

The resulting output is not parsable by a strict POSIX.1-2008 shell but sh
from FreeBSD 9.0 and newer and many other shells can parse it.
2014-12-14 16:26:19 +00:00

8 lines
137 B
Plaintext

# $FreeBSD$
key=`printf '\r\t\001\200\300'`
r=`{ set -x; : "$key"; } 2>&1 >/dev/null`
case $r in
*[![:print:]]*) echo fail; exit 3
esac