pass-otp
pass-otp copied to clipboard
Use command -v instead of which to prevent errors on stderr
I upgraded to a more recent version of otp.bash and now I'm getting an error message like this preceding my otp output:
which: no otptool in (/home/evan/.local/bin:/home/evan/go/bin:/usr/share/Modules/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin)
This fixes the issue by using command -v instead of which; it's also possible to fix this by redirecting which stderr to /dev/null, but using command instead of which is better anyway because command is a bash builtin.
Duplicate of #116
Thank you for pointing to the #116
The underlying issue is that script fails if otptool is not found in the system. In my case, I have been unable to install it in RHEL8, and found nothing googling about it.
Is there any way to make otptool available so the otp.bash script doesn't fail in the which statement? Is there any other option, taking into account that the script seems to work without it?
@tadfisher as I can tell by https://github.com/tadfisher/pass-otp/pull/116#issuecomment-691537592 I see you're against using command -v over which, but would you accept a change which would at least suppress all the error messages caused by which?
These are really annoying and while I still think command -v is 100% the way to go (even upstream pass relies on it and uses it), I'd want to have any sort of half-solution to this problem.