15 lines
401 B
Bash
Executable File
15 lines
401 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# First check if lastpass is correctly initialized
|
|
if lpass ls 1>/dev/null 2>&1; then
|
|
# success
|
|
lpass ls | grep $1 | awk '{ if (match($0,/\[id: (.*)?\]/,m)) print m[1] }' | xargs lpass show
|
|
# --color=always --format="%ai %au %ap" # unable to use because lpass is buggy with the formatting
|
|
else
|
|
# failure
|
|
echo -n "Enter login name: "
|
|
read loginname
|
|
lpass login $loginname
|
|
fi
|
|
|