Score:0

automatic (user) input for command in shell script

cn flag

Issue:
I am writing an install script for setting up a machine.
At some point there is a user input required, like so:

chia keys add
# echo comes back: please enter 24 word mnemonic passphrase
hello this is an example mnemonic passphrase ... ... ... ... ...

likewise, another command requires userinput as well

chia wallet show
# echo comes back: No wallet file was found. To generate wallet, enter S
S

Question:
How can I automate these two user inputs in shell script? Is it just a matter of writing these commands?

chia keys add
hello this is an example mnemonic passphrase ... ... ... ... ...
chia wallet show
s
FedKad avatar
cn flag
Did you try IO redirection? For example `echo hello... | chia keys add` and `echo s | chia wallet show`. Also look at the command line options of the command `chia`.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.