1 2 3 4 5 6 7 8 9
#!/bin/bash fn=$1 f() { eval "$fn" "$@"; } a=$2 b=$3 shift 3 [[ -z "$b" ]] && exec echo "$a" exec "$0" "$fn" "$(f "$a" "$b")" "${@@Q}"