#!/bin/bash # This script removes the specified interface if it exists if [[ $EUID != 0 ]]; then echo "This script needs sudo priveleges" echo "Exiting..." exit 1 fi for INT in $(ls /sys/class/net); do if [[ $INT == $1 ]]; then /sbin/ip link delete dev $1 type tap DELETED=true break fi done if [[ !$DELETED ]]; then echo "Interface $1 not found, nothing to delete" exit 1 fi