I want to write a bash script to get block count . It is giving error
./script.sh: line 4: =: command not found
Below is my script
#!/bin/bash
# getblockcount
$blockcount = bitcoin-cli getblockcount
echo $blockcount
Kindly tell what is wrong .
I want to write a bash script to get block count . It is giving error
./script.sh: line 4: =: command not found
Below is my script
#!/bin/bash
# getblockcount
$blockcount = bitcoin-cli getblockcount
echo $blockcount
Kindly tell what is wrong .
 
    
    There should not be space around the operator.. So remove the space around = and thing should work. Also there are some other bits.. Here is the corrected one.. Ensure command bitcoin-cli getblockcount from terminal  gives right result.
#!/bin/bash
# getblockcount
blockcount=$(bitcoin-cli getblockcount)
echo $blockcount
