5
rated 0 times
[
5]
[
0]
/ answers: 1 / hits: 5942
/ 2 Years ago, sat, september 17, 2022, 10:08:22
How could I capture the console output into a variable when running a utility so I can filter the text?
Example: I am trying to capture the console output when I type bitcoind
so that I can filter out the rpcpassword and write it to a config file.
ubuntu@ip-172-31-3-49:~$ bitcoind
Error: To use bitcoind, you must set a rpcpassword in the configuration file:
/home/ubuntu/.bitcoin/bitcoin.conf
It is recommended you use the following random password:
rpcuser=bitcoinrpc
rpcpassword=Eb5WDgzKqt77U4LhvvfnYxaNvw2rpztSvM5XKsonXBWC
(you do not need to remember this password)
The username and password MUST NOT be the same.
If the file does not exist, create it with owner-readable-only file permissions.
It is also recommended to set alertnotify so you are notified of problems;
for example: alertnotify=echo %s | mail -s "Bitcoin Alert" [email protected]
More From » bash