From 20246a6b2bca9269d9a09a4f8eb6ee7c515d3801 Mon Sep 17 00:00:00 2001 From: aarondill Date: Wed, 5 Jul 2023 14:19:08 -0500 Subject: [PATCH] "Simplify" script Thanks shfmt for pointing out these agressive simplifications that are possible, but not necisarily needed. Now can I pass CI? Please? :smile: --- install.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index df950ae..21da57b 100755 --- a/install.sh +++ b/install.sh @@ -26,7 +26,7 @@ usage() { # sets RETVAL to sudo command to use, exits script if no command can be found # optional user command is passed as an argument, if it fails, attempts to use sudo/doas. elevate_priv() { - if [ -n "${1:-}" ]; then # user input + if [ -n "${1-}" ]; then # user input if "$1" true; then RETVAL="$1" return 0 @@ -72,7 +72,7 @@ main() { set -u # Detect and print host target triple. - if [ -n "${ARCH:-}" ]; then + if [ -n "${ARCH-}" ]; then # if the user specifed, trust them - don't error on unrecognized hardware. local _arch="${ARCH}" else @@ -90,7 +90,7 @@ main() { _bin_dir=${BIN_DIR:-${_bin_dir}} _man_dir=${MAN_DIR:-${_man_dir}} _arch=${ARCH:-${_arch}} - _sudo=${SUDO:-} + _sudo=${SUDO-} assert_nz "${_arch}" "arch" log "Detected architecture: ${_arch}" @@ -156,7 +156,7 @@ main() { _sudo="" else log "Escalated permissions are required to install man pages to ${_man_dir}" - elevate_priv "${_sudo:-${SUDO:-}}" # use previously found command OR user defined + elevate_priv "${_sudo:-${SUDO-}}" # use previously found command OR user defined _sudo=${RETVAL} log "Installing zoxide man pages as root using ${_sudo}, please wait…" fi