geluk / pass-winmenu

An easy-to-use password manager for Windows, compatible with pass.
MIT License
385 stars 25 forks source link

dmenu script username issue #47

Closed willpower232 closed 5 years ago

willpower232 commented 5 years ago

I was having a problem with the dmenu script where it wasn't picking up my username for some of my password files.

I tracked it down to [[ $username -eq 0 ]] which was having a bad time presumably because the affected usernames weren't email addresses so didn't contain . or @.

I'll admit I'm not that great at bash scripting but I couldn't figure out what the difference between [ -z "$username" ] and [[ $username -eq 0 ]] is or why you would want to test for both.

I've removed [[ $username -eq 0 ]] from mine for now and it has resolved my problem but I was wondering if there was a more appropriate resolution.

geluk commented 5 years ago

That script is a bit of a mess, I've modified it a long time ago since, but I seem to have forgotten to update it. It should print the username only if it detects a username in the password file (hence the test for -z "$username". The --no-username switch is then meant to disable that feature. I have no idea why I used the same variable for the username and the --no-username switch, that was never going to work.

I've modified the script, but it really needs some more work. Can you check if the updated version works correctly for you?

willpower232 commented 5 years ago

Ah of course yes its working perfectly now.

FYI the only other change I've made is to add -i into the dmenu call so that it works as case insensitive as I've made use of CamelCase in several of my file names.

Thanks for your help!