Many of these things are contained in my shell script template
miscellany
Thanks to this stack overflow answer, there's some sense of language design in sh:
beginswith() { case "$2" in "$1"*) true;; *) false;; esac; }
if beginswith '/' '/tmp'; then echo "absolute"; fi