channel_hopper() { local iface="${1}" while : ; do for i in $(seq 1 13); do sleep 1 echo switch to channel "${i}" iw dev "${iface}" set channel "${i}" done done } channel_hopper wlan0