From: Stanislav Brabec Date: Wed, 28 Feb 2024 14:06:14 +0000 (+0100) Subject: setterm: Document behavior of redirection X-Git-Tag: v2.40-rc2~12 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c0b2650acab9ec0aa1ab9473bf422afa920ed262;p=thirdparty%2Futil-linux.git setterm: Document behavior of redirection Debugging an error of setterm, I realized that setterm --powerdown operates on stdout but setterm --powersave operates on stdin. Such unexpected behavior should be documented. I prefer a less accurate generic "always redirect both stdin and stdout" over recommending of the correct I/O stream for each option separately. Signed-off-by: Stanislav Brabec (cherry picked from commit 4aa584a0e7482b89599c01986cd4ea69a397f808) --- diff --git a/term-utils/setterm.1.adoc b/term-utils/setterm.1.adoc index 880fe10d63..365c4bb009 100644 --- a/term-utils/setterm.1.adoc +++ b/term-utils/setterm.1.adoc @@ -156,6 +156,10 @@ Turns underline mode on or off. include::man-common/help-version.adoc[] +== WARNING + +Use of *setterm* in combination with stdout redirection can have unexpected results, as some options operate on stdin. To prevent problems, always redirect both stdin and stdout to the same device. + == COMPATIBILITY Since version 2.25 *setterm* has support for long options with two hyphens, for example *--help*, beside the historical long options with a single hyphen, for example *-help*. In scripts it is better to use the backward-compatible single hyphen rather than the double hyphen. Currently there are no plans nor good reasons to discontinue single-hyphen compatibility.