Skip to content

Instantly share code, notes, and snippets.

@mdtareque
Created August 19, 2020 02:24
Show Gist options
  • Select an option

  • Save mdtareque/2c43a129f13f7cfe090abc0e3475f348 to your computer and use it in GitHub Desktop.

Select an option

Save mdtareque/2c43a129f13f7cfe090abc0e3475f348 to your computer and use it in GitHub Desktop.

Revisions

  1. mdtareque created this gist Aug 19, 2020.
    26 changes: 26 additions & 0 deletions macVerbalFeedback.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@

    #https://askubuntu.com/questions/873719/how-to-set-a-variable-to-a-random-value-with-bash

    #https://stackoverflow.com/questions/16553089/dynamic-variable-names-in-bash

    #http://mywiki.wooledge.org/BashFAQ/006#Indirection

    #declare "magic_variable_$1=v$(( $RANDOM % 1000 ))" ; var="magic_variable_$1"; echo "${!var}"
    #read ${!var}
    #echo $v396

    function verbal_feedback ()
    {
    echo "enter any character and press enter, to stop verbal feedback.";
    while [ 1 == 1 ]; do
    declare "magic_variable=v$(( $RANDOM % 1000 ))" ; var="magic_variable"; dvar=${!var}; echo "${!var}"
    read -t 2 $dvar
    if [ ! -z "${!dvar}" ]; then
    echo "$dvar is ${!dvar}";
    break;
    else
    say -v Daniel "build completed";
    sleep 1;
    fi;
    done
    }