#!/bin/bash SUBDOMAINS=("thirdculture.top" "ppl.thirdculture.top" "files.thirdculture.top" "up.thirdculture.top" "events.thirdculture.top" "music.thirdculture.top" "social.thirdculture.top" "visual.thirdculture.top") HOSTS_FILE="/etc/hosts" add_subdomains() { echo "Adding subdomains to /etc/hosts..." for SUBDOMAIN in "${SUBDOMAINS[@]}"; do if ! grep -q "$SUBDOMAIN" "$HOSTS_FILE"; then echo "127.0.0.1 $SUBDOMAIN" | sudo tee -a "$HOSTS_FILE" > /dev/null echo "Added $SUBDOMAIN to /etc/hosts" else echo "$SUBDOMAIN is already in /etc/hosts" fi done } remove_subdomains() { echo "Removing subdomains from /etc/hosts..." for SUBDOMAIN in "${SUBDOMAINS[@]}"; do sudo sed -i "/$SUBDOMAIN/d" "$HOSTS_FILE" echo "Removed $SUBDOMAIN from /etc/hosts" done } case "$1" in add) add_subdomains ;; remove) remove_subdomains ;; *) echo "Usage: $0 {add|remove}" exit 1 ;; esac