From 9e8cd7bec5fc9f1ec9b39a71722c82b9448802ad Mon Sep 17 00:00:00 2001 From: tschettervictor <85497460+tschettervictor@users.noreply.github.com> Date: Mon, 16 Dec 2024 19:08:26 -0700 Subject: [PATCH] accept only one arg on htop --- usr/local/share/bastille/htop.sh | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/usr/local/share/bastille/htop.sh b/usr/local/share/bastille/htop.sh index 3dc9dbe6..685d59d4 100644 --- a/usr/local/share/bastille/htop.sh +++ b/usr/local/share/bastille/htop.sh @@ -42,33 +42,22 @@ case "$1" in ;; esac -if [ $# -eq 0 ]; then - usage -else - TARGET="${1}" - shift -fi - -if [ "${TARGET}" = "ALL" ]; then - target_all_jails -else - check_target_exists "${TARGET}" -fi - -if [ $# -ne 0 ]; then +# Accept only one argument. +if [ $# -eq 0 ] || [ $# -gt 1 ]; then usage fi +set_target_single "${1}" bastille_root_check -for _jail in ${JAILS}; do +for _jail in "${JAILS}"; do check_target_is_running "${_jail}" - bastille_jail_path=$(/usr/sbin/jls -j "${_jail}" path) + bastille_jail_path="$(/usr/sbin/jls -j "${_jail}" path)" if [ ! -x "${bastille_jail_path}/usr/local/bin/htop" ]; then error_notify "htop not found on ${_jail}." elif [ -x "${bastille_jail_path}/usr/local/bin/htop" ]; then info "[${_jail}]:" - jexec -l ${_jail} /usr/local/bin/htop + jexec -l "${_jail}" /usr/local/bin/htop fi echo -e "${COLOR_RESET}" done