Create a wallet starting from a 24 words seed phrase (cardano-cli and cardano-address or cardano-wallet binaries are required for this script).
#!/bin/bash
NET="testnet"
NET_WITH_MAGIC="--testnet-magic 2"
# create a new wallet
cardano-address recovery-phrase generate > phrase.prv
chmod 400 phrase.prv
cat phrase.prv | cardano-address key from-recovery-phrase Shelley > rootkey.prv
chmod 400 rootkey.prv
cat rootkey.prv | cardano-address key child 1852H/1815H/0H/2/0 > stake.prv
cardano-cli key convert-cardano-address-key --signing-key-file stake.prv --shelley-stake-key --out-file stake.skey
cardano-cli key verification-key --signing-key-file stake.skey --verification-key-file Ext_ShelleyStake.vkey
cardano-cli key non-extended-key --extended-verification-key-file Ext_ShelleyStake.vkey --verification-key-file stake.vkey
cardano-cli stake-address build --stake-verification-key-file stake.vkey --out-file stake.addr ${NET_WITH_MAGIC}
rm Ext_ShelleyStake.vkey stake.prv
cat rootkey.prv | cardano-address key child 1852H/1815H/0H/0/0 > payment.prv
cardano-cli key convert-cardano-address-key --signing-key-file payment.prv --shelley-payment-key --out-file payment.skey
cardano-cli key verification-key --signing-key-file payment.skey --verification-key-file Ext_ShelleyPayment.vkey
cardano-cli key non-extended-key --extended-verification-key-file Ext_ShelleyPayment.vkey --verification-key-file payment.vkey
cardano-cli address build --payment-verification-key-file payment.vkey --stake-verification-key-file stake.vkey --out-file payment.addr ${NET_WITH_MAGIC}
rm Ext_ShelleyPayment.vkey payment.prv