Thanks for the tips - they inspired me to write a callstack function. I used the 'column' command for esthetics.
callstack() {
local j=0 k prog=$(basename $0)
for ((i=1; ((i<${#BASH_ARGC[*]})); i++))
do
echo -n "${FUNCNAME[$i]/main/$prog} " # function name
args=""
for ((k=0; ((k<${BASH_ARGC[$i]})); k++))
do
args="${BASH_ARGV[$j]} $args" # arguments
let j++
done
echo -e "$args\t|${BASH_LINENO[$i]}" $(sed -n ${BASH_LINENO[$i]}p "$0" 2>/dev/null) # line calling the function
done | column -t -s $'\t' -o ' ' | sed 1d # delete callstack entry
}
compareTemplates brother_001270_1.jpg |163 compareTemplates "$f" # process the rest
processPdf brother_001270.pdf |233 filetype "${f%[*}" pdf && processPdf "$f"
process brother_001270.pdf |371 --process) shift; process "$@"; exit ;; # process jpg or pdf
sm --quiet --process brother_001270.pdf |0