# note: a bash shell function to take notes on a removable USB stick
#
# place this into your $HOME/.bashrc or
# source this file within your $HOME/.bashrc
function note () { 
    local note;                                # don't override global variables
    local notes="/vol/flash/.conf.d/notes";
    if test  -t 0; then                        # when connected to a console
        echo -e "\033[1;34;7mType in text terminated by CTRL-D.\033[m";
    else
        echo -e "\033[1;34;7mOK\033[m";        # gives a `blue' OK
    fi
    if note=$(fold -s)  &&  test -n "$note"    # empty notes will not be noted 
    then
        echo -e "\n============ $(date +%'A, %-e %B at %R') ============\n${note}"  >>$notes;
    else
        echo -e "\033[1mNo text added!\033[m" 1>&2;
    fi
}
