10/03/21 Notes
Bash Training
Began watching "Automation With Shell Scripting" by NarendraP.

Wrote my own bash script to handle mining two different currencies.

#!/bin/bash

mining_function () {
    echo 'This script process a single argument.'

    # Invalid argument supplied
    if [ $1 != 'eth' -a $1 != 'ETH' -a $1 != 'etc' -a $1 != 'ETC' ]; then
    echo "You entered ${1}. You must enter eth or etc."
    exit 0
    fi

    # Valid  argument supplied
    # Set ETH address
    if [ $1 == 'eth' -o $1 == 'ETH' ]; then
    ADDRESS='67890'
    SERVER='asia1.ethermine.org'
    # Set ETC address
    elif [ $1 == 'etc' -o $1 == 'ETC' ]; then
    ADDRESS='12345'
    SERVER='asia1-etc.ethermine.org'
    fi

    # Begin mining. Use two stratum servers to continuously retry connecting.
    USERNAME=$(whoami)
    echo "You will be mining ${1}"
    /home/${USERNAME}/Downloads/linux-ethminer-0.19.0/bin/ethminer -P stratums://${ADDRESS}.linux_hasha@${SERVER}:5555 -P stratums://${ADDRESS}.linux_hasha@${SERVER}:5555 --cu-devices 0 1
}

mining_function $1