Multi coin command script

So I am mining multiple coins and wrote this little script to make life a bit easier.

# written by geeksincode
# donations : chia xch1z7pu4uww5xstm3wh90dd0ytjs3wafc2qyysrxqej0frr5e2yjvqqsnp4mx : BTC 3QH7taL14zdwidpeazMntMe8PdA5PmPQGx

#!/bin/env
echo "Enter coin name"
read coin
# make sure coin name is lower case.
coin=${coin,,}
echo "Enter command only"
# Example - farm summary do not add ex. chia
read coin_command
# You must set username location
Environment=PATH=/home/user/$coin-blockchain/venv/bin:${PATH}
/usr/bin/env $Environment $coin ${coin_command}

rewritten, now just a 1 line command.

# written by geeksincode
# donations : chia xch1z7pu4uww5xstm3wh90dd0ytjs3wafc2qyysrxqej0frr5e2yjvqqsnp4mx : BTC 3QH7taL14zdwidpeazMntMe8PdA5PmPQGx

#!/bin/env
# You must set username location

coin_command=$@
coin=${coin_command%% *}
# You must set username location
Environment=PATH=/home/username/$coin-blockchain/venv/bin:${PATH}
/usr/bin/env $Environment ${coin_command}

save as ‘coins’ then sudo chmod +x coins and sudo mv coins /usr/bin

usage: coins chia show -s

Capture

I tried this and it just seems to hang up…

image

I got this working by making a few changes. I got away from the /usr/bin folder by just adding an alias at the very end of my .bashrc file the /home/username directory.

alias coin="~/sourcecode/coin $@"

Then loaded that new .bashrc by running this command from the /home/username directory:

source .bashrc

I used nano to create a new file under a folder called “sourcecode” in the /home/username directory. Switched to “#!/bin/bash” instead of “#!/bin/env”. And got rid of the Environment stuff.

#!/bin/bash
coin_command=$@
coin=${coin_command%% *}
~/$coin-blockchain/venv/bin/$coin_command

And I added executable to the mode.

chmod +x ~/sourcecode/coin

All done.

Here is a screenshot of the source files and the command running for Chia and HDDcoin.
image