#!/bin/bash err_script() { if [ "$2" ]; then msg="Error: could not change to directory '$1': $2" else msg="Error: could not change to directory '$1'." fi printf "printf '%s\n' %q\n" "$msg" cat <