I have the following bash (snippet):
while IFS= read -r line
case "$line" in \#*) continue ;; esac
echo "Executing command: $line"
sshpass -p$KARAF_SSH_PASS ssh user@localhost -p 8101 "$line";
echo "Exit code: $exit_code."
done < "$COMMANDS_FILE"
This executes only once. The output is kind of this:
> #commented line
> Executing command: command1 // first line to be executed from $COMMANDS_FILE
> Password authentication // output from ssh authentication
> some other command result
> Exit code: 0.
Normally the process should continue with the next line, but it stops here. Do you have any idea why this?
If I comment the line containing the execution:
> sshpass -p$KARAF_SSH_PASS ssh user@localhost -p 8101 "$line";
than, I get listed all lines from file. Do you have any idea how to get executed all lines from file?