#!/bin/bash do_this_on_ctrl_c(){ echo "Stopped searching!" exit 0 } trap 'do_this_on_ctrl_c' SIGINT printf "ip: %s" "$1" printf "\n%s" "waiting for Device ..." while ! ping -c 1 -n -w 1 $1 &> /dev/null do printf "%c" "." done printf "\n%s\n" "Device is online" pio run -t upload -e d1_mini-ota --upload-port $1