I have created a local Ethereum test net. I am using truffle to send transactions to EVM nodes. I have created a bash script that looks as follows (send_transactions.sh):
sudo truffle console --network ethrpc1 exec ./batch.js .exit sudo truffle console --network ethrpc2 exec ./batch.js .exit sudo truffle console --network ethrpc3 exec ./batch.js .exit sudo truffle console --network ethrpc4 .exit
ethrpc1, ethrpc2, ethrpc3, and ethrpc4 are my EVM nodes. The batch.js has the transactions that I send to each of these nodes.
The above bash script stops working after the line "sudo truffle console --network ethrpc1". It opens the truffle console and remains there without executing the rest of the commands in the bash script.
I have got this to work by typing these in my Linux command prompt manually but the shell script does not work. Is there a way to get the above commands to work using a bash script or is there an alternative method to automate sending transactions to multiple nodes without doing it manually?
I am using Ubuntu 18.04.3 LTS AWS EC2 instance
Truffle version: Truffle v5.1.28