BASH – List based FOR loop

 

For example, there is a file "/home/artem/IP" with IP addresses on which you want to execute a remote command, the FOR loop will look like this:

 

IP="$(cat /home/artem/IP)"

for i in $IP
do
    ssh [email protected]$i 'hostname'
done
0 0 vote
Article Rating

Tagged: Tags

Подписаться
Уведомление о
guest
0 Comments
Inline Feedbacks
View all comments