ssh - fix unbound variable error

This commit is contained in:
2022-07-04 11:46:48 +02:00
parent 8d75b261f1
commit 27a55e2623

View File

@@ -78,10 +78,10 @@ step_10_info() {
step_10_alias() { echo "sendlist"; } step_10_alias() { echo "sendlist"; }
step_10() { step_10() {
shift shift
aList=$1 aList=${1:-}
aHost=$2 aHost=${2:-}
# Set port only if not empty # Set port only if not empty
if [ ! -z "$3" ]; then if [ -n "${3:-}" ]; then
aPort=$3 aPort=$3
fi fi
parseList $aList parseList $aList
@@ -113,8 +113,8 @@ step_10() {
parseList() { parseList() {
local errorMsg="" local errorMsg=""
if [ -z "$1" ] || [ ! -f "$1" ]; then if [ -z "${1:-}" ] || [ ! -f "${1:-}" ]; then
if [ -z "$1" ]; then if [ -z "${1:-}" ]; then
error -e "No Command list found" error -e "No Command list found"
else else
error -e "Command list not found: $1" error -e "Command list not found: $1"
@@ -132,7 +132,7 @@ parseList() {
return 1 return 1
fi fi
info "Parsing $(realpath $1) ..." info "Parsing $(realpath -- "${1:-}") ..."
local line=1 local line=1
# Working loop without ssh "stealing standard input" by # Working loop without ssh "stealing standard input" by
# https://unix.stackexchange.com/questions/24260/reading-lines-from-a-file-with-bash-for-vs-while # https://unix.stackexchange.com/questions/24260/reading-lines-from-a-file-with-bash-for-vs-while