Skip to content

Instantly share code, notes, and snippets.

@skihero
Created September 10, 2014 06:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skihero/1f58208b0f6cb717d45e to your computer and use it in GitHub Desktop.
Save skihero/1f58208b0f6cb717d45e to your computer and use it in GitHub Desktop.
simple seq imp stolen
#!/bin/bash
#set -x
seq () {
if [ -z "$3" ]; then
incr=1
j=$2
else
incr=$2
j=$3
fi
i=$1
while [[ i -le j ]]; do
echo -ne $i
echo -ne " "
let i+=$incr
done
START_RANGE=1
END_RANGE=5200
RANGE=$(seq ${START_RANGE} 1000 ${END_RANGE})
REST_OF="a.b.cp"
echo "Pinging machine..."
for i in $RANGE
do
MACHINE="vmw${i}.${REST_OF}"
ping -n 2 ${MACHINE}
if [[ $? -eq 0 ]]; then
echo "REACHABLE: ${MACHINE} "
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment