Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

eklitzke
Copy link

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.

@roddhjav
Copy link

roddhjav commented Mar 9, 2021

Duplicate of #116

@methadata
Copy link

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?

@zneix
Copy link

zneix commented May 27, 2022

@tadfisher as I can tell by #116 (comment) 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants