1

The .bash_profile file has the alias below.

~# cat .bash_profile
# other commands
alias btcblock="echo $(bitcoin-cli getblockcount 2>&1)/$(wget -O - http://blockchain.info/q/getblockcount 2>/dev/null)"

But if I run the command and shortly thereafter the alias, the results showed are different, as below:

~# echo $(bitcoin-cli getblockcount 2>&1)/$(wget -O - http://blockchain.info/q/getblockcount 2>/dev/null)
503967/534428
~# btcblock
503839/534428

It's like the results of alias is always outdated. Any idea why it's happening ?

0

1 Answer 1

3

In the command alias btcblock="echo $(...)/$(...)", the two $()s are executed and interpolated when the alias is defined, because this is how "..." quoting works.

You probably wanted to write alias btcblock='echo $(...)/$(...)', with ' (single quotes) instead of " (double quotes).

Not the answer you're looking for? Browse other questions tagged .