Added more comments

This commit is contained in:
Marco Raber 2020-08-24 10:18:23 +02:00
parent e89aec7852
commit b3238b4ebd

View File

@ -1,7 +1,6 @@
#!/bin/bash #!/bin/bash
export BW_SESSION = your token here export BW_SESSION = your token here
# [[ $# -eq 0 ]] && query=$(zenity --entry --text="Site" --entry-text="git..") || query=$@
[[ $# -eq 0 ]] && query=$(echo -e "\n" | dmenu -p "What to search:") || query=$@ [[ $# -eq 0 ]] && query=$(echo -e "\n" | dmenu -p "What to search:") || query=$@
# the query is passed through parameters, if not it's asked through a text-box # the query is passed through parameters, if not it's asked through a text-box
@ -12,14 +11,15 @@ passwords=""
json=$(bw list items --search $query) json=$(bw list items --search $query)
length=$(echo $json | jq -r 'length') #how many accounts found for that site length=$(echo $json | jq -r 'length') #how many accounts found for that site
for row in $(echo "${json}" | jq -r '.[] | @base64'); do for row in $(echo "${json}" | jq -r '.[] | @base64'); do
_jq() { #this function is used to loop through the multiple results _jq() { #this function is used to loop through the multiple results
echo ${row} | base64 --decode | jq -r ${1} echo ${row} | base64 --decode | jq -r ${1}
} }
# echo $(_jq '.login.username') # echo $(_jq '.login.username')
user="$(echo $(_jq '.login.username'))" user="$(echo $(_jq '.login.username'))"
usersdmenu="$usersdmenu$user\n" usersdmenu="$usersdmenu$user\n" #array used for the choosing phase in dmenu
userssplit="$userssplit$user," userssplit="$userssplit$user," #array used for extracting the password from the json
password="$(_jq '.login.password')" password="$(_jq '.login.password')"
passwords="$passwords$password," passwords="$passwords$password,"
done done