Fehler beim Ausführen von Skripten auf mehreren Remote-Hosts durch ssh

Ich schreibe eine deployAll.sh, die die Datei ip_host.list zeilenweise liest, und füge dann eine Gruppe für alle Remote-Hosts hinzu.

wenn ich laufe: sh deployAll.sh

Ergebnisse

Group is added to 172.25.30.11

nicht erwartete Ergebnisse:

Group is added to 172.25.30.11
Group is added to 172.25.30.12  
Group is added to 172.25.30.13

Warum wird nur der erste ausgeführt? bitte helfen sie, vielen dank!

deployAll.sh

    #!/bin/bash

    function deployAll()
    {
        while read line;do
            IFS=';' read -ra ipandhost<<< "$line"
            ssh "${ipandhost[0]}" "groupadd -g 1011 test"
            printf "Group is added to ${ipandhost[0]}\n"
        done < ip_host.list
    }

deployAll

ip_host.list

172.25.30.11;test-30-11
172.25.30.12;test-30-12
172.25.30.13;test-30-13

Antworten auf die Frage(4)

Ihre Antwort auf die Frage