.bashrc.d/20nobeep: Fallback to -blength if --blength doesn't work
authorW. Trevor King <wking@tremily.us>
Wed, 11 Jul 2018 22:24:54 +0000 (15:24 -0700)
committerW. Trevor King <wking@tremily.us>
Wed, 11 Jul 2018 22:41:14 +0000 (15:41 -0700)
I'd bumped from -blength to --blength in abee64c4 (.bashrc.d/20nobeep:
Change '-blength' -> '--blength', 2015-03-19), expecting to never see
util-linux < 2.25 or so again.  But I've recently been exposed to a
RHEL 7.5 system, which has:

  $ setterm -version
  setterm from util-linux 2.23.2
  $ setterm --help 2>&1 | grep blength
   -blength <0-2000>

so this commit adds code to attempt the single-dash form if the
double-dash form fails.

src/.bashrc.d/20nobeep

index 6e6176f739dc8882555fffc25a277de5ac9a38b1..e6587ed067f80d47945f08f2623192adfbdac03b 100644 (file)
@@ -7,7 +7,7 @@ fi
 
 # turn of terminal beeps in the console, unless connecting via SSH
 if [ -n "$TERM" ] && [ -z "$SSH_CLIENT" ]; then
-       setterm --blength 0
+       setterm --blength 0 2>/dev/null || setterm -blength 0
 fi
 
 # turn off beeps in Firefox