{"id":1625,"date":"2020-03-06T01:10:48","date_gmt":"2020-03-05T22:10:48","guid":{"rendered":"https:\/\/artem.services\/?p=1623"},"modified":"2020-03-06T01:14:07","modified_gmt":"2020-03-05T22:14:07","slug":"1625","status":"publish","type":"post","link":"https:\/\/artem.services\/?p=1625&lang=en","title":{"rendered":"\u00a0BASH &#8212; List based FOR loop"},"content":{"rendered":"<p><img loading=\"lazy\" class=\"aligncenter size-full wp-image-568\" src=\"https:\/\/artem.services\/wp-content\/uploads\/2019\/01\/BASH-Logo.png\" alt=\"\" width=\"376\" height=\"159\" srcset=\"https:\/\/artem.services\/wp-content\/uploads\/2019\/01\/BASH-Logo.png 376w, https:\/\/artem.services\/wp-content\/uploads\/2019\/01\/BASH-Logo-300x127.png 300w\" sizes=\"(max-width: 376px) 100vw, 376px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>For example, there is a file &quot;<strong>\/home\/artem\/IP<\/strong>&quot; with <strong>IP<\/strong> addresses on which you want to execute a remote command, the <strong>FOR<\/strong> loop will look like this:<\/p>\n<p>&nbsp;<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nIP=&quot;$(cat \/home\/artem\/IP)&quot;\r\n\r\nfor i in $IP\r\ndo\r\n    ssh root@$i 'hostname'\r\ndone\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; For example, there is a file &quot;\/home\/artem\/IP&quot; with IP addresses on which you want to execute a remote command, the FOR loop will look like this: &nbsp;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[415],"tags":[427,1277,1279,1281],"_links":{"self":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/1625"}],"collection":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1625"}],"version-history":[{"count":2,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/1625\/revisions"}],"predecessor-version":[{"id":1628,"href":"https:\/\/artem.services\/index.php?rest_route=\/wp\/v2\/posts\/1625\/revisions\/1628"}],"wp:attachment":[{"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1625"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1625"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/artem.services\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1625"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}