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