#!/bin/env bash # A POSIX variable OPTIND=1 # Reset in case getopts has been used previously in the shell. # Initialize our own variables: wg_interface="" while getopts "h?i:" opt; do case "$opt" in h|\?) #show_help echo "Usage: isolate.sh -i " exit 0 ;; i) wg_interface=$OPTARG ;; esac done shift $((OPTIND-1)) [ "${1:-}" = "--" ] && shift set -x iptables -I FORWARD -i $wg_interface -o $wg_interface -j DROP set +x