#!/bin/bash SLEEP_TIME=2 while getopts p:t: flag; do case "${flag}" in p) PROXY_CHOICE=${OPTARG} ;; t) SLEEP_TIME=${OPTARG} ;; *) ;; esac done SOURCE=${BASH_SOURCE[0]} while [ -L "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink DIR=$(cd -P "$(dirname "$SOURCE")" >/dev/null 2>&1 && pwd) SOURCE=$(readlink "$SOURCE") [[ $SOURCE != /* ]] && SOURCE=$DIR/$SOURCE # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located done DIR=$(cd -P "$(dirname "$SOURCE")" >/dev/null 2>&1 && pwd) source "$DIR/config.sh" if [ -n "$PROXY_CHOICE" ]; then our_proxy_server="${PROXY_SERVERS[$PROXY_CHOICE]}" echo "Using $our_proxy_server" else our_proxy_server="" fi while true; do echo "--> START <--" DATA=$( cat < DONE <--\n" sleep $SLEEP_TIME done