diff options
author | Quentin Young <qlyoung@nvidia.com> | 2021-12-06 05:31:11 +0100 |
---|---|---|
committer | Donald Sharp <sharpd@nvidia.com> | 2022-06-16 18:20:36 +0200 |
commit | da9601225f52d0409b0a214966711579cbbdc392 (patch) | |
tree | 2839ad632c078b5f731977b277ed27ffd595683b /tools | |
parent | tools: print daemon start cmd, vtysh_b cmd (diff) | |
download | frr-da9601225f52d0409b0a214966711579cbbdc392.tar.xz frr-da9601225f52d0409b0a214966711579cbbdc392.zip |
tools: apply various shellcheck recommendations
Signed-off-by: Quentin Young <qlyoung@nvidia.com>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/frrcommon.sh.in | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/frrcommon.sh.in b/tools/frrcommon.sh.in index a610e56d3..c168edc50 100755 --- a/tools/frrcommon.sh.in +++ b/tools/frrcommon.sh.in @@ -52,7 +52,7 @@ is_user_root () { debug() { [ -n "$watchfrr_debug" ] || return 0 - printf '%s %s(%s):' "`date +%Y-%m-%dT%H:%M:%S.%N`" "$0" $$ >&2 + printf '%s %s(%s):' "$(date +%Y-%m-%dT%H:%M:%S.%N)" "$0" $$ >&2 # this is to show how arguments are split regarding whitespace & co. # (e.g. for use with `debug "message" "$@"`) while [ $# -gt 0 ]; do @@ -78,8 +78,8 @@ vtysh_b () { return 0 fi - cmd="$VTYSH `echo $nsopt` -b" - [ -n "$1" ] && cmd+=" -d $1" + cmd="$VTYSH $nsopt -b" + [ -n "$1" ] && cmd="${cmd} -d $1" log_success_msg "Sending config with '$cmd'" eval "$cmd" @@ -168,7 +168,7 @@ daemon_start() { daemon_inst "$1" - ulimit -n $MAX_FDS > /dev/null 2> /dev/null + [ "$MAX_FDS" != "" ] && ulimit -n "$MAX_FDS" > /dev/null 2> /dev/null daemon_prep "$daemon" "$inst" || return 1 if test ! -d "$V_PATH"; then mkdir -p "$V_PATH" @@ -208,7 +208,7 @@ daemon_stop() { [ -r "$pidfile" ] || fail="pid file not found" $all && [ -n "$fail" ] && return 0 - [ -z "$fail" ] && pid="`cat \"$pidfile\"`" + [ -z "$fail" ] && pid="$(cat \"$pidfile\")" [ -z "$fail" -a -z "$pid" ] && fail="pid file is empty" [ -n "$fail" ] || kill -0 "$pid" 2>/dev/null || fail="pid $pid not running" @@ -242,7 +242,7 @@ daemon_status() { pidfile="$V_PATH/$daemon${inst:+-$inst}.pid" [ -r "$pidfile" ] || return 3 - pid="`cat \"$pidfile\"`" + pid="$(cat \"$pidfile\")" [ -z "$pid" ] && return 1 kill -0 "$pid" 2>/dev/null || return 1 return 0 @@ -366,7 +366,7 @@ frrcommon_main() { cmd="$1" shift - if [ "$1" = "all" -o -z "$1" ]; then + if [ "$1" = "all" ] || [ -z "$1" ]; then case "$cmd" in start) all_start;; stop) all_stop;; |