export)
# The mock keyring format simply lists the appropriate lines here.
# The "files" are actually key IDs.
- for keyid in "${Files[@]}"; do
- [ ${#keyid} -gt 8 ] && keyid=${keyid:0-8}
+ if [ "${#Files[*]}" -gt 0 ]; then
+ for keyid in "${Files[@]}"; do
+ [ ${#keyid} -gt 16 ] && keyid=${keyid:0-16}
+ if [ x${OutputFile:+set} = xset ]; then
+ grep -h '^0*'"$keyid": "${Keyrings[@]}" > "$OutputFile"
+ else
+ grep -h '^0*'"$keyid": "${Keyrings[@]}"
+ fi
+ done
+ else
+ # Export everything if no keys are selected.
if [ x${OutputFile:+set} = xset ]; then
- grep -h '^0*'"$keyid": "${Keyrings[@]}" > "$OutputFile"
+ cat "${Keyrings[@]}" > "$OutputFile"
else
- grep -h '^0*'"$keyid": "${Keyrings[@]}"
+ cat "${Keyrings[@]}"
fi
- done
+ fi
;;
delete-key)
# This simply requires removing the indicated ID from all keyrings.