aboutsummaryrefslogtreecommitdiff
path: root/sh
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-12-01 23:46:33 +1300
committerTom Ryder <tom@sanctum.geek.nz>2016-12-01 23:46:33 +1300
commite7722300f9cb3182f9d2101dadc4b34a6dc34e68 (patch)
treeb9a0cedbf755ca148443b59d6c36299448ec2597 /sh
parentFix man page filename (diff)
downloaddotfiles-e7722300f9cb3182f9d2101dadc4b34a6dc34e68.tar.gz
dotfiles-e7722300f9cb3182f9d2101dadc4b34a6dc34e68.zip
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
Diffstat (limited to 'sh')
-rw-r--r--sh/shrc8
1 files changed, 5 insertions, 3 deletions
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))