#! /bin/sh status=0 interrupt() { mutex "echo -en '\e8\e[0m'" exit $status } mutex "echo -en '\e7'" trap interrupt RETURN SIGHUP SIGINT SIGTERM SIGQUIT column=0 row=0 label=$$ if [ $# -gt 1 ] then label=$1 if [ $# -gt 2 ] then column=$1 label=$2 if [ $# -gt 3 ] then column=$1 row=$2 label="$3" shift fi shift fi shift fi while : do mutex "echo -en '\e7\e[$row;${column}H\e[47;30;1m$label\e8\e[0m'" eval "$1 &>/dev/null" status=$? if [ $status -eq 0 ] then mutex "echo -en '\e7\e[$row;${column}H\e[42;37;1m$label\e8\e[0m'" else mutex "echo -en '\e7\e[$row;${column}H\e[41;37;1m$label\e8\e[0m'" fi eval "$2" done