diff options
author | Aaron Ball <nullspoon@oper.io> | 2018-06-02 10:39:18 -0600 |
---|---|---|
committer | Aaron Ball <nullspoon@oper.io> | 2018-06-02 10:39:18 -0600 |
commit | c0b905ef5cacb1f52dedde0d329c223d3dd29a90 (patch) | |
tree | c30a6fa2dd79693c55634a214296644912310cf3 /pt | |
parent | ed18399ed844789b161b947f3000fc393f85cc0d (diff) | |
download | bin-c0b905ef5cacb1f52dedde0d329c223d3dd29a90.tar.gz bin-c0b905ef5cacb1f52dedde0d329c223d3dd29a90.tar.xz |
pt:Fixed various printf statements
Some passwords that started with one or two - characters would break
printf. Added the -- switch to avoid further switch parsing.
Also quoted a couple of variables to avoid problems with spaces.
Changed xdotool type rate to 20 ms between characters, since some
services don't like people who type with 15 ms between chars.
Diffstat (limited to 'pt')
-rwxr-xr-x | pt | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -29,7 +29,7 @@ function log { if [[ $(type -p notify-send) != '' ]]; then notify-send "$(basename ${0}):" "${msg}" fi - echo ${msg} + printf -- '%s\n' "${msg}" } @@ -73,7 +73,7 @@ getfield() { local _delim="${2:-}" local _field="${3:-}" - printf "${_content}" \ + printf -- "%s" "${_content}" \ | sed -n "s/${_field}${_delim} *\(.*\)/\1/p" \ | head -n 1 } @@ -96,11 +96,11 @@ function main { # Check if the password exists in the store # Also, copy the contents into a variable if it exists - _passentry=$(pass ${@} 2>/dev/null) + _passentry="$(pass ${@} 2>/dev/null)" [[ $? -gt 0 ]] && log "Error: '${@}' is not in the password store" && exit 1 # Parse pass output into appropriate variables - _passpassword=$(printf "${_passentry}" | head -n1) + _passpassword=$(printf -- "%s" "${_passentry}" | head -n1) _passusername=$(getfield "${_passentry}" ':' username) _passdelim=$(getfield "${_passentry}" ':' delim) _passsubmit=$(getfield "${_passentry}" ':' submit) @@ -113,9 +113,9 @@ function main { fi # Type the password - xdotool type --delay 15 "${_passusername}" + xdotool type --delay 20 "${_passusername}" xdotool key "${_delim}" - xdotool type --delay 15 "${_passpassword}" + xdotool type --delay 20 "${_passpassword}" [ "${_submit}" = 1 ] && xdotool key Return } |