I am adding some aliases to .bashrc to discourage people from using standard commands where there is a more complex process involved in achieving the desired result. But how can I set the exit code in case the alias is invoked from a script? Ideally without generating a spurious error message like "no such file or directory" (I did find this, but surely there a cleaner way?)
e.g.
alias useradd='echo "Nope....you should be using the custom script."'
should result in.....
# useradd newuser
Nope....you should be using the custom script.
# echo $?
-1
#
-1
)? – jesse_b Sep 04 '19 at 21:20fail(){ echo >&2 "$1"; return 1; }; ...; alias useradd='fail "no useradd for you!"'
– Sep 04 '19 at 22:13