pass-otp icon indicating copy to clipboard operation
pass-otp copied to clipboard

Use command -v instead of which to prevent errors on stderr

Open eklitzke opened this issue 5 years ago • 3 comments

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.

eklitzke avatar Oct 21 '20 02:10 eklitzke

Duplicate of #116

roddhjav avatar Mar 09 '21 20:03 roddhjav

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?

methadata avatar Mar 09 '21 23:03 methadata

@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.

zneix avatar May 27 '22 12:05 zneix