#!/bin/bash set -e set -o pipefail case "$0" in [^/]* ) PATH=$(realpath -e "$(dirname "$BASH_SOURCE")"):$PATH ;; esac source rpc.bash main() { funcs=$(find_local_only_functions "$@" &2 } find_local_only_functions() { remote_commands=($(remote_run_function all_commands | sort -u)) printf 'remote commands: %d\n' ${#remote_commands[@]} >&2 intersection <(extract_words < "$BASH_SOURCE") \ <(difference <(all_commands) \ <(printf '%s\n' "${remote_commands[@]}")) } all_commands() { : main compgen -A command | sort -u } main "$@"