From: W. Trevor King Date: Mon, 4 Mar 2013 06:15:18 +0000 (-0500) Subject: .bashrc.d/20nobeep: Style and POSIX cleanups X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=24a2543986a1a4a5f097a6ef93d9219b31bff152;p=dotfiles-public.git .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. --- 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