spm

simple password manager
git clone anongit@rnpnr.xyz:spm.git
Log | Files | Refs | Feed | README | LICENSE

Commit: 6d22886b7f953d0a085623960bb3f7d5e50de42c
Parent: 82e26fd97c3bf255bd14e44f6e8e084169ef9852
Author: Klemens Nanni
Date:   Fri,  5 Aug 2016 18:13:35 +0200

Use find(1)'s printf not sed(1)

Diffstat:
Mspm.sh | 12++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/spm.sh b/spm.sh @@ -53,8 +53,9 @@ readpw() { [ -z "${2}" ] && usage 'Empty password' } -_search() { - find "${STORE_DIR}"/ \( -type f -o -type l \) -iwholename "*${1}*".gpg +_find() { + find "${STORE_DIR}"/ \( -type f -o -type l \) -iwholename "*${1}*".gpg \ + -printf "${2:-%p\n}" } view() { @@ -86,19 +87,18 @@ list() { } del() { - entry=$(_search "${1}" | head -n2) + entry=$(_find "${1}" | head -n2) check rm -i "${entry}"; printf '\n' } search() { - _search "${1}" \ - | sed -e s^"${STORE_DIR}"/ \ + _find "${1}" '%P\n' \ | view } show() { - entry=$(_search "${1}" | head -n2) + entry=$(_find "${1}" | head -n2) check gpg --decrypt "${entry}" }