问题:
我正在编写一个用于设置机器的安装脚本。
有时需要用户输入,如下所示:
chia keys add
# echo comes back: please enter 24 word mnemonic passphrase
hello this is an example mnemonic passphrase ... ... ... ... ...
同样,另一个命令也需要用户输入
chia wallet show
# echo comes back: No wallet file was found. To generate wallet, enter S
S
问题:
如何在 shell 脚本中自动执行这两个用户输入? 只需编写这些命令即可吗?
chia keys add
hello this is an example mnemonic passphrase ... ... ... ... ...
chia wallet show
s
答案1
在这种情况下,只需使用 Echo 即可完成。
chia keys add
echo hello this is an example mnemonic passphrase ... ... ... ... ...
chia start wallet
echo S|chia wallet show