Skip to content

Instantly share code, notes, and snippets.

@FiloSottile
Last active August 29, 2015 14:13
Show Gist options
  • Save FiloSottile/de1bad55dbcfcc50cd79 to your computer and use it in GitHub Desktop.
Save FiloSottile/de1bad55dbcfcc50cd79 to your computer and use it in GitHub Desktop.
password-store rekey script
#! /bin/bash
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -euo pipefail
IFS=$'\n\t'
readonly PASSWORD_STORE=~/.password-store
relpath() {
python -c "import os.path; print os.path.relpath('$1','${2:-$PWD}')"
}
get_name() {
relpath "$1" "$PASSWORD_STORE" | sed 's/\.gpg$//'
}
for n in "$PASSWORD_STORE"/**/*.gpg; do
EDITOR=true pass edit $(get_name "$n")
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment