Code Snippets

Tag: Loops

Loop SSH Across Hosts

Run the same command on a list of hosts with -o BatchMode for key-only auth.

Author: chris

Loop Over Files in a Directory

Iterate over matched files with a glob — safe with nullglob set.

Author: chris

Read a File Line by Line in Perl

Open a filehandle and iterate over a text file one line at a time, chomping trailing newlines.

Author: chris