cnssh: Read out sshopts when needed instead of involving an intermediary variable

This commit is contained in:
David Thurstenson 2021-05-06 15:53:26 -05:00
parent 397f7bd166
commit 85380e3a27
1 changed files with 5 additions and 5 deletions

View File

@ -108,10 +108,6 @@ cnssh() { # Helper for sshing into Crestron devices
;; ;;
esac esac
for opt in "${!sshopts[@]}"; do
sshoptstring="$sshoptstring -o $opt=${sshopts[$opt]}"
done
# Option Parsing # Option Parsing
#### ####
@ -121,7 +117,11 @@ cnssh() { # Helper for sshing into Crestron devices
sshpass -p "${cnssh_conf[pass]}" \ sshpass -p "${cnssh_conf[pass]}" \
"${cnssh_conf[method]}" \ "${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]}" "${cnssh_conf[cmd]}"
# Main # Main