Skip to content

Instantly share code, notes, and snippets.

@harasakih
Created May 22, 2019 17:24
Show Gist options
  • Save harasakih/50875d0f72a566a7a6f97b48a0a734c0 to your computer and use it in GitHub Desktop.
Save harasakih/50875d0f72a566a7a6f97b48a0a734c0 to your computer and use it in GitHub Desktop.
コマンド文字列を生成して発行する
#!/bin/bash
# --+----1----+----2----+----3----+----4----+----5----+----6
# 変数初期化
# --+----1----+----2----+----3----+----4----+----5----+----6
#
nHOSTS=100
nTRIES=500 # 試行回数
WAIT=1 # インターバル
echo "nHOSTS=$nHOSTS"
echo "nTRIES=$nTRIES"
echo "wait(s)=$WAIT"
echo -n "GO -- Y/N.. "
read YN
[ $YN != "Y" ] && exit 1
echo ":: start at `date` ::"
for (( i=0; i < $nTRIES; i++ ))
do
RAND=$(( $RANDOM % nHOSTS ))
HOST=`printf "test%03d.test" $RAND`
printf "iteration %4d %s\n" $i $HOST
nslookup $HOST 192.168.0.121
done
echo ":: finish at `date` ::"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment