Skip to content

Instantly share code, notes, and snippets.

@rcbop
Created June 19, 2019 12:15
Show Gist options
  • Save rcbop/8cdccf533df6b30473cdd1d10ce8aa33 to your computer and use it in GitHub Desktop.
Save rcbop/8cdccf533df6b30473cdd1d10ce8aa33 to your computer and use it in GitHub Desktop.
vault tree walk
#!/usr/bin/env bash
function walk() {
for secret in $(vault list $1 | tail -n +3)
do
if [[ ${secret} == *"/" ]] ; then
walk "${1}${secret}"
else
echo "${1}${secret}"
fi
done
}
query="${1}"
if [[ ${query} != *"/" ]] ; then
query=${query}/
fi
echo "${1}"
walk ${query}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment