Open CaptainQuirk opened 8 years ago
Not clear what you're trying to do but just a few comments:
env
. type() { builtin type "$1" &>/dev/null; }
should do the exact same thing overriding type
to be quiet. The last command's $?
is always returned, so no need for those last two lines.
Hi there,
Following on #38, I'm having an issue trying to stub out the type bash builtin.
I made a simple function around it to check if an executable is available on my system.
Before that, I was using the following construct
This allowed me to actually make my stubbed type function get priority over the built-in. I could then define a dummy stub that would exit with 1 or 0, depending on my case. Unfortunately, this construct fails because it stops at my environment and doesn't fall back, so to speak, to the bash built-in if no env type function is found.
Now, maybe I am trying to test something untestable ... My goal was to make sure that my is_installed function would return the result of the type call and that my program would in the appropriaté manner if a dependency was missing.
What do you think ?
Thanks in advance !