as-set

скрипт определяющий какие AS-ки входят в as-set

#!/bin/bash
 
tmpfile=/tmp/as-set.tmp
asfile=/tmp/as-set
asset=$1
 
if [ "$asset" != "" ];then
 
  if [ -e $asfile ];then
    rm $asfile
  fi
  touch $asfile
  touch $tmpfile
 
  ar()
  {
    arr=(` whois $asset | grep members | awk '{print $2}'`)
    if [ "$arr" != "" ];then
      for i in "${arr[@]}"
        do
          if [ "`echo $i | grep AS-`" = "" ];then
            echo "$i" >> $tmpfile
          else
            asset=$i
            ar
          fi
        done
    else
      echo "AS-SET not exist"
    fi
  }
  ar
 
  while read LINE
  do