From e7722300f9cb3182f9d2101dadc4b34a6dc34e68 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 1 Dec 2016 23:46:33 +1300 Subject: setterm(1) isn't as standard as I thought It's not available on default installs of any of the three major open-source BSDs, and isn't specified by POSIX. I only noticed this because the implement of sh(1) in NetBSD 7.0 seems to emit errors from calls to `command -p` to the terminal, regardless of any redirection of standard output and error: $ uname -a NetBSD faeroes 7.0.1_PATCH NetBSD 7.0.1_PATCH (GENERIC.201607220540Z) amd64 $ command -p setterm setterm: not found $ command -p setterm >/dev/null setterm: not found $ command -p setterm >/dev/null 2>&1 setterm: not found --- sh/shrc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'sh') diff --git a/sh/shrc b/sh/shrc index 8dab79c6..3e03313c 100644 --- a/sh/shrc +++ b/sh/shrc @@ -7,12 +7,14 @@ esac # Don't let anyone write(1) to my terminal command -p mesg n -# Never beep at me -command -p setterm -bfreq -blength 2>/dev/null - # Turn off flow control and control character echo command -p stty -ixon -ctlecho 2>/dev/null +# If setterm(1) is available, tell it never to beep at me +if command -v setterm >/dev/null 2>&1 ; then + setterm -bfreq -blength 2>/dev/null +fi + # Keep around 4K lines of history in memory HISTSIZE=$((1 << 12)) -- cgit v1.2.3