Bash version 4.4.20 / Ubuntu 16.0.4
Hello,
I tried to write a script that gathers some data and passes them to an executable.
The executed application answers with an error. The echo output in the script returns correct values.
If I copy/paste the last echo command, it get's executed correctly.
You can't reproduce the error, maybe you can improve the code that it should work then.
#!/bin/bash
#creates an array with name gettx
declare -a gettx
#enter your public address from: StealthCoind getaddressesbyaccount ""
pubaddress=mzYfB7ZEurhm8UosBc1a5t4QtRCHjtVw4Z
#enter your pubkey from: StealthCoind getqposinfo
pubkey=0364d6d9039b74c69e2a7dabd81ff27c5cab0b7d54cda0f7419b94e02ff91f9
#Does a transaction and stores the transaction id into the txid variable
txid=$(StealthCoind sendtoaddress $pubaddress 0.01)
#Fill the gettx array with the needed vout number
gettx=($(awk -F: '{split($2,a,","); print a[1]}' <<<"$(StealthCoind gettransaction $txid | sed -n /0.01000000/,/}/p)"))
#Show content of txid for debugging
echo "TXID: $txid"
#show vout number for debugging
echo "vout n: ${gettx[1]}"
#show the build command chain for debugging
echo "StealthCoind claimqposbalance $txid ${gettx[1]} 10"
#execute the command to claim
StealthCoind claimqposbalance $txid ${gettx[1]} 10