I am running test contracts on the Ethereum testnet using geth. I need to make a file similar to a batch script which can execute commands one by one all in one go hence I am using expect to do so.

I keep getting the error: "extra characters after close-brace while executing" whilst running the script which is strange as I have removed the inner "" and converted them into ''.

Below is my incomplete expect script, any suggestions for friendlier alternatives to do doing this would be great.

spawn /usr/bin/geth --testnet console
expect ">"
send     "personal.unlockAccount('0xdc85a8429998bd4eef79307e556f70bb70d8caf1','bitc    oin');\r"
expect "true"
expect ">"
send "var mortalContract = web3.eth.contract([{'constant':false,'inputs':[],'name':'kill','outputs':  [],'type':'function'},{'constant':false,'inputs':  [],'name':'cashOut','outputs':[],'type':'function'},{'inputs':[],'type':'constructor'}]);\r"
send "exit\r"
expect eof

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.