I have the below script for getting all private keys from Electrum wallets:
#!/usr/bin/env bash
for file in *;
do
electrum -w "./$file" listaddresses --offline | electrum getprivatekeys - --password one_password_for_all_wallets -w "./$file" --offline 2> /dev/null | jq -r ".[]"
done
How to provide Electrum CLI the password, because he asks for it for each wallet?