diff options
author | Rasmus Steinke <rasi@xssn.at> | 2016-05-24 22:50:37 +0200 |
---|---|---|
committer | Rasmus Steinke <rasi@xssn.at> | 2016-05-24 22:50:37 +0200 |
commit | 395f9ac47a335cf00f885a99ce035bc53ba72966 (patch) | |
tree | c1b41f9d9e2db840e3beff1af8532ffc161d6eae | |
parent | ef6b68abbfe3ecfdbcc38d77db2684846b91acf7 (diff) | |
parent | b88bb64072428547ce4b4cd4b9fe9462873f6779 (diff) | |
download | rofi-pass-395f9ac47a335cf00f885a99ce035bc53ba72966.tar.gz |
Merge pull request #38 from dhxgit/master
Some minor shellcheck fixes.
-rwxr-xr-x | rofi-pass | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -7,7 +7,7 @@ basecommand=$(echo "$0" | gawk '{ print $1 }') # get all password files and create an array list_passwords() { - cd "${root}" + cd "${root}" || exit passwords=( **/*.gpg ) for password in "${passwords[@]}"; do @@ -53,7 +53,7 @@ autopass () { for word in ${stuff["$AUTOTYPE_field"]}; do if [[ $word == ":tab" ]]; then xdotool key Tab; elif [[ $word == ":space" ]]; then xdotool key space; - elif [[ $word == ":delay" ]]; then sleep ${delay}; + elif [[ $word == ":delay" ]]; then sleep "${delay}"; elif [[ $word == ":enter" ]]; then xdotool key Return; elif [[ $word == "pass" ]]; then echo -n "${password}" | xdotool type --clearmodifiers --file -; else echo -n "${stuff[${word}]}" | xdotool type --clearmodifiers --file - @@ -333,7 +333,7 @@ showEntry () { echo "not doing anything" else if [[ -z $(echo -n "${stuff[${word}]}") ]]; then - xdotool type ${word} + xdotool type "${word}" else echo -n "${stuff[${word}]}" | xdotool type --clearmodifiers --file - xdotool key ctrl+alt @@ -342,7 +342,7 @@ showEntry () { if [[ ${count} == "off" ]]; then exit else - sleep ${count} + sleep "${count}" fi showEntry elif [[ ${rofi_exit} -eq 1 ]]; then @@ -362,7 +362,7 @@ manageEntry () { mainMenu elif [[ $1 == "move" ]]; then - cd "${root}" + cd "${root}" || exit selected_password2=$(basename "$selected_password" .gpg) group=$(find -type d -not -iwholename '*.git*' -printf '%d\t%P\n' | sort -r -nk1 | cut -f2- | _rofi -dmenu -p "Choose Group > ") if [[ $group == "" ]]; then exit; fi @@ -404,7 +404,7 @@ insertPass () { if [[ $insertmenu == "0 Return to Main Menu" ]]; then mainMenu elif [[ $insertmenu == "" ]]; then exit elif [[ $insertmenu == "* Accept Values and Add Password Entry" ]]; then - cd "${root}" + cd "${root}" || exit group=$(echo -e "No Group\n---\n$(find -type d -not -iwholename '*.git*' -printf '%d\t%P\n' | sort -r -nk1 | cut -f2-)" | _rofi -dmenu -p "Choose Group > ") if [[ "$group" == "No Group" ]]; then PASSWORD_STORE_DIR="${root}" pass insert -m -f "${name}" < <(echo -e "${pass}\n${USERNAME_field}: ${user}\n---\n${URL_field}: ${domain}") @@ -499,13 +499,13 @@ if [[ -f /etc/rofi-pass.conf ]]; then fi # check if local config exists and load it -if [[ -f $HOME/.config/rofi-pass/config ]]; then - source $HOME/.config/rofi-pass/config +if [[ -f "$HOME/.config/rofi-pass/config" ]]; then + source "$HOME/.config/rofi-pass/config" fi # create tmp dir if [[ ! -d /tmp/$USER-rofi-pass ]]; then - mkdir /tmp/$USER-rofi-pass + mkdir "/tmp/$USER-rofi-pass" fi # set help color @@ -524,7 +524,7 @@ fi # check if alternative root directory was given on commandline if [[ -r "/tmp/$USER-rofi-pass/last_used" ]] && [[ $1 == "--last-used" || $1 == "--show-last" ]]; then - export root=$(awk -F ': ' '{ print $1 }' /tmp/$USER-rofi-pass/last_used) + export root; root=$(awk -F ': ' '{ print $1 }' "/tmp/$USER-rofi-pass/last_used") elif [[ -n "$2" && "$1" == "--root" ]]; then export root="${2}" elif [[ -n $root ]]; then @@ -550,13 +550,13 @@ export PASSWORD_STORE_DIR="${root}" ;; --last-used) if [[ -r "/tmp/$USER-rofi-pass/last_used" ]]; then - entry="$(awk -F ': ' '{ print $2 }' /tmp/$USER-rofi-pass/last_used)" + entry="$(awk -F ': ' '{ print $2 }' "/tmp/$USER-rofi-pass/last_used")" fi mainMenu ;; --show-last) if [[ -r "/tmp/$USER-rofi-pass/last_used" ]]; then - selected_password="$(awk -F ': ' '{ print $2 }' /tmp/$USER-rofi-pass/last_used)" showEntry + selected_password="$(awk -F ': ' '{ print $2 }' "/tmp/$USER-rofi-pass/last_used")" showEntry else mainMenu fi |