Best way to pin multiple hashes

Is it possible to pin a list of hashes, coming from a file for example?
My usecase is I run a node on a respberry pi and want to update the list of what it seeds. Thank you!

The line: ipfs pin ls -t recursive -q
Will dump a list of things that were pinned to the repo.
I often run this over ssh to then mirror those pins to another machine.
A loop can actually pin those between machines, I used bash,

mapfile -t pins < <(ssh “$s” ipfs pin ls -t recursive -q | sort)
for pin in “${pins[@]}”
do
until ipfs pin add -r “$pin”
do
sleep 1
done
done

Thank you @trees-smoke, that’s really helpful, your code inspired me to make a simple version of it.
If I understand correctly, the pinning process will stop if one of the hash is not found right? If I want to watch several hashes at the same time, should I open a separate terminal tab for each tab?

I’ll break it down,

mapfile -t pins < <(ssh "$s" ipfs pin ls -t recursive -q | sort)

enters the pinned items from server $s into variable ‘pins’

for pin in "${pins[@]}"
do

first loop, loop through every pinned item we received.

until ipfs pin add -r "$pin"
do

Second loop, keep trying to pin the hash, no matter how much it fails, until completion.

sleep 1
done
done

Sleeps one second between errors, otherwise continues pinning.

So this will iterate through each hash sequentially trying to pin it, looping forever until it does. The second loop was ‘mostly’ from the older days when ipfs would crap out in the middle of a hash for almost no reason.

If you wanted it to do try to pin everything in parallel you would want to background a process and remove a loop.