sekrit-rekey: change for ... in $(cmd) to cmd | while read

This commit is contained in:
Lucas 2022-01-16 14:23:14 +00:00
parent 73880fb104
commit 71019bf806

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# env # env
# Written in 2020 by Lucas # Written in 2020,2022 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved # CC0 1.0 Universal/Public domain - No rights reserved
# #
# To the extent possible under law, the author(s) have dedicated all # To the extent possible under law, the author(s) have dedicated all
@ -38,7 +38,7 @@ scratch=$(mktemp -tp "$newdir" .sekrit-scratch-XXXXXXXXXX) ||
err "failed to create scratch file" err "failed to create scratch file"
trap 'rm -fr -- "$scratch" "$newdir"' INT QUIT TERM trap 'rm -fr -- "$scratch" "$newdir"' INT QUIT TERM
for entry in $(sekrit ls | grep -v ^DONE); do sekrit ls | while read -r entry; do
printf "%s... " "$entry" printf "%s... " "$entry"
sekrit get "$entry" >|"$scratch" || sekrit get "$entry" >|"$scratch" ||
err "failed to export entry $entry" err "failed to export entry $entry"