I wonder if there is an easier way to execute a script in bash only if this script exists. What I want is equivalent to:
if [ -x $name ]
then
$name
fi
or
[ -x $name ] && $name
What I'm looking for is something like
exec_if_exist $name
which eliminates the repetition of the script name.
Is there a way to simplify this in bash? I do not need a function or "speculative" execution that would give the command an error not found.
The best
source
share