Um hash e uma função de pesquisa podem ser parecidos com
#!/usr/bin/env bash
declare -A proggies
# "aliases" and then the path said should expand to
proggies[foo]=/some/big/long/stupid/path/foo
proggies[bar]=/some/big/long/stupid/path/bar
function qrunner {
local exe
exe=${proggies[$1]}
if [[ -z "$exe" ]]; then
echo >&2 "no mapping for '$1'"
return 1
fi
# echo here is for debugging, remove when ready to
# really break things
echo qsub job.sh "$exe" "$2"
}
# positive test
qrunner bar filename
echo $?
# and also a negative one
qrunner nope filename
echo $?