#!/usr/bin/env zsh SCRIPT_DIR=$(dirname $(realpath $0)) cd $SCRIPT_DIR rm .{un,}docked while true; do if [ "$(./check_docked.sh)" = "docked" ]; then if [ -e .docked ]; then continue fi echo docking... rm -f .undocked sh/docked.sh touch .docked else if [ -e .undocked ]; then continue fi echo undocking... rm -f .docked sh/undocked.sh touch .undocked fi sleep 5 done