0

How can I pass a variable as the input/parameter for a command.

The command solana-keygen recover ASK prompts the user to input a seed phrase. How would I go about writing a shell script that enters the seed phrase for me?

abh1sheke
  • 11
  • 4
  • `echo "blah" | solana-keygen recover ASK` would be my starting point but some apps do "clever" things with stdin to stop simple things like this working. – John3136 Jun 10 '22 at 04:00
  • _that enters the seed phrase for me?_ : How does `solana-keygen` read the response? Does it do it from stdin? In this case, a simple redirection (as explained by John3136) should be fine. If it reads directly from the tty device, you would need something like [expect](https://www.man7.org/linux/man-pages/man1/expect.1.html). – user1934428 Jun 10 '22 at 05:57
  • Also see [Have bash script answer interactive prompts](https://stackoverflow.com/q/3804577/4154375). – pjh Jun 10 '22 at 12:42

0 Answers0