Skip to content

Instantly share code, notes, and snippets.

@mrbalihai
Last active March 10, 2016 13:12
Show Gist options
  • Save mrbalihai/3480a62f1ef1947db1ce to your computer and use it in GitHub Desktop.
Save mrbalihai/3480a62f1ef1947db1ce to your computer and use it in GitHub Desktop.
Copy passbox to clipboard
# Add the following to your .bashrc
# USAGE: pass "password entry name"
function pass() {
local PASS=$(passbox get ${1} | grep Password\: | cut -c 10-)
echo $PASS > /dev/clipboard # /dev/clipboard is for cygwin but this could be replaced with any clipboard command e.g:
# `echo $PASS | xclip -selection clipboard` # Linux with xclip
# `echo $PASS | pbcopy # OSX/Darwin
echo ""
echo "Copied password to clipboard for 15s"
sleep 15
echo "" > /dev/clipboard # This also needs changing as on line 5 to reflect your desired clipboard e.g:
# `echo "" | xclip -selection clipboard` # Linux with xclip
# `echo "" | pbcopy # OSX/Darwin
echo "Clipboard cleared"
}
alias pass="pass"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment