#!/bin/sh -e test -f "$1" || { >&2 echo "usage: ${0##*/} "; exit 1; } test -x "$(which entr)" || exit 2 test -x "$(which shellcheck)" || exit 3 a=$(readlink -f "$1") if test -r "${1}_test" then b=$(readlink -f "${1}_test") else b='' fi if test -n "$2" then test -d "$2" || { >&2 echo "$2: no dir"; exit 1; } wa="$2/$1" wb="$2/${1}_test" else wa="$a" wb="$b" fi test -f "$b" || b="$HOME/bin/no_tests" tmux split-window -p 95 "vim $a" tmux split-window -p 40 -dh \ "ls $wa $wb | entr -rc sh -c 'echo $a;shellcheck $a $b && sh $b'"