From 24a2543986a1a4a5f097a6ef93d9219b31bff152 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Mon, 4 Mar 2013 01:15:18 -0500 Subject: [PATCH] .bashrc.d/20nobeep: Style and POSIX cleanups * `which` is not in POSIX 2008, use `command -v` instead. * Avoid the temporary XSET variable. * Reorganize to consolidate if statements. --- src/.bashrc.d/20nobeep | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/.bashrc.d/20nobeep b/src/.bashrc.d/20nobeep index 50fc3ec..a887db6 100644 --- a/src/.bashrc.d/20nobeep +++ b/src/.bashrc.d/20nobeep @@ -1,15 +1,11 @@ # turn off terminal beep in X -if [ $TERM == "xterm" ] && [ -n "$DISPLAY" ]; then - XSET=$(which xset 2> /dev/null) - if [ -n "${XSET}" ]; then +if [ -n "$DISPLAY" ] && [ "$TERM" == "xterm" ]; then + if [ -x "$(command -v xset)" ]; then xset b off fi; - unset XSET fi # turn of terminal beeps in the console, unless connecting via SSH -if [ -z "$SSH_CLIENT" ]; then - if [ ! -z "$TERM" ]; then - setterm -blength 0 - fi +if [ -n "$TERM" ] && [ -z "$SSH_CLIENT" ]; then + setterm -blength 0 fi -- 2.26.2