Working with multiple computers in Bash
Working with multiple computers in Powershell is absurdly easy using the Get-Content cmdlet to read computer names from a text file. It’s as easy as this…
$a = Get-Content "C:\Scripts\Test.txt"
foreach ($i in $a)
{$i + "`n" + "=========================="; Get-WMIObject Win32_BIOS -computername $i}
As I’m doing more and more bash scripting I thought it would be useful to replicate this. Here’s how you do it;
#!/bin/bash
for c in `cat computers.txt`
do
# Do work with each computer here...
echo "Computer = $c";
done