#!/bin/bash cd "$(dirname "$0")" line="$1" state="$2" { [[ "$line" =~ ^[0-9]+$ ]] && [[ "$state" =~ ^[01]$ ]]; } || { echo >&2 "usage: $0 <0|1>"; exit 1; } . config.txt ip_prefix=${server_ip%.*} ip="$ip_prefix.$line" ./admin_scripts/auto_answer.pl "$ip" "$telnet_pass" 2 "$state"