xrsh-com/com/isoterminal/mnt/hook

12 lines
295 B
Bash
Executable File

#!/bin/sh
test -z $1 && { echo "usage: hook <cmd_or_jsfunction> [args]"; exit 0; }
cmd=$1
shift
test -d ~/hook.d/$cmd && {
find ~/hook.d/$cmd/ -type f -executable | while read hook; do
{ $hook "$@" || true; } | awk '{ gsub(/\/root\/\//,"",$1); $1 = sprintf("%-40s", $1)} 1'
done
}