Friday, December 26, 2008

Use Z-Shell for loop to Compact Argument List

The other day I pinged a number of remote workstations to observe Round Trip Times (RTT) but forgot to eliminate a few series of contiguously numbered remotes that were known to be powered-off. Needless to say, the pinging effort was taking longer than it should have -- I promptly aborted the effort. Here is an example of a compact way of performing this common task using a Z-Shell for loop.

# zsh
# for blog in {1..5} {7..13} {15..22} {27..37}
for> ping -s mysysad$blog 1024 5

No comments: