mirror of
https://github.com/ChristopherA/Learning-Bitcoin-from-the-Command-Line.git
synced 2025-06-07 16:06:26 +00:00
Update 3_3__Using_Command-Line_Variables.md
This commit is contained in:
parent
52e926b08f
commit
a25afbf7b6
@ -1,6 +1,6 @@
|
|||||||
# Interlude: Using Command-Line Variables
|
# Interlude: Using Command-Line Variables
|
||||||
|
|
||||||
The previous section demonstrated a number of command-line commands used without obfuscation or interference. However, that's often not the best way to run Bitcoin from the command line. Because you're dealing with long, complex, and unreadable variables, it's easy to make a mistake if you're copying those variables around (or, satoshi forfend, if you're typing them in by hand). Because those variables can mean the difference between receiving and losing real money, you don't _want_ to make mistakes. For these reasons, we suggest using command-line variables to save addresses, signatures, or other long strings of information whenever it's reasonable to do so.
|
The previous section demonstrated a number of command-line commands used without obfuscation or interference. However, that's often not the best way to run Bitcoin from the command line. Because you're dealing with long, complex, and unreadable variables, it's easy to make a mistake if you're copying those variables around (or, satoshi forfend, if you're typing them in by hand). Because those variables can mean the difference between receiving and losing real money, you don't _want_ to make mistakes. For these reasons, we strongly suggest using command-line variables to save addresses, signatures, or other long strings of information whenever it's reasonable to do so.
|
||||||
|
|
||||||
If you're using `bash`, you can save information to a variable like this:
|
If you're using `bash`, you can save information to a variable like this:
|
||||||
```
|
```
|
||||||
@ -20,7 +20,6 @@ You can then use your shell's `echo` command to look at your (new) address:
|
|||||||
$ echo $NEW_ADDRESS_1
|
$ echo $NEW_ADDRESS_1
|
||||||
n4cqjJE6fqcmeWpftygwPoKMMDva6BpyHf
|
n4cqjJE6fqcmeWpftygwPoKMMDva6BpyHf
|
||||||
```
|
```
|
||||||
|
|
||||||
Because you have your address in a variable, you can now easily sign a message for that address, without worrying about typoing the address. You'll of course save that signature into a variable too!
|
Because you have your address in a variable, you can now easily sign a message for that address, without worrying about typoing the address. You'll of course save that signature into a variable too!
|
||||||
```
|
```
|
||||||
$ NEW_SIG_1=$(bitcoin-cli signmessage $NEW_ADDRESS_1 "Hello, World")
|
$ NEW_SIG_1=$(bitcoin-cli signmessage $NEW_ADDRESS_1 "Hello, World")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user