From 85380e3a27808ccd1a060210a4f6abd9189a8c7c Mon Sep 17 00:00:00 2001 From: David Thurstenson Date: Thu, 6 May 2021 15:53:26 -0500 Subject: [PATCH] cnssh: Read out sshopts when needed instead of involving an intermediary variable --- .bashrc.d/cnssh.bash | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.bashrc.d/cnssh.bash b/.bashrc.d/cnssh.bash index 8293033..6bc3b9c 100644 --- a/.bashrc.d/cnssh.bash +++ b/.bashrc.d/cnssh.bash @@ -108,10 +108,6 @@ cnssh() { # Helper for sshing into Crestron devices ;; esac - for opt in "${!sshopts[@]}"; do - sshoptstring="$sshoptstring -o $opt=${sshopts[$opt]}" - done - # Option Parsing #### @@ -121,7 +117,11 @@ cnssh() { # Helper for sshing into Crestron devices sshpass -p "${cnssh_conf[pass]}" \ "${cnssh_conf[method]}" \ - $sshoptstring \ + $( # Format sshopts as a string that an ssh program understands + for opt in "${!sshopts[@]}"; do + printf '%s %s=%s ' "-o" "$opt" "${sshopts[$opt]}" + done + ) \ "${cnssh_conf[cmd]}" # Main