Wednesday, May 1, 2024
 Popular · Latest · Hot · Upcoming
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

 Answers
4

Redirect the output to a file e.g.



bitcoind >~/bitcoind_output.txt 2>&1


This will put the output in a file in your home directory called bitcoind_output.txt


[#26875] Sunday, September 18, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
entmpy

Total Points: 52
Total Questions: 112
Total Answers: 113

Location: Marshall Islands
Member since Tue, Sep 21, 2021
3 Years ago
entmpy questions
;