A simple todo list for your shell
This simple script lists today’s tasks every time you log in (or create a new window in your screen).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# Just add me to your .bashrc: # [ -x ~/.bashrc_today ] && . ~/.bashrc_today TODAYD="${HOME}/.today.d" if [ ! -d "${TODAYD}/today" ]; then mkdir -p "${TODAYD}/today" fi TODAY=$(date +%F) function toDay() { local DAY=${1}; shift; local CARD=${1}; shift; local TODO=${*} ( if [ ! -d "${TODAYD}/${DAY}" ]; then mkdir -p "${TODAYD}/${DAY}" fi ) && ( echo "${TODO} [+${TODAY}]" >> "${TODAYD}/${DAY}/${CARD}" ) && ( echo -n "${TODAYD}/${DAY}/${CARD}: " cat "${TODAYD}/${DAY}/${CARD}" ) } echo -n -e "Today is \033[0;36m$(date +%A)\033[0m, \033[0;35m${TODAY}\033[0m" if [ -d "${TODAYD}/${TODAY}" ] && STUFF=$(ls "${TODAYD}/${TODAY}") && [ -n "${STUFF}" ]; then for CARD in ${STUFF}; do (cat "${TODAYD}/${TODAY}/${CARD}" >> "$TODAYD/today/${CARD}") && rm -f "${TODAYD}/${TODAY}/${CARD}" done rmdir "${TODAYD}/${TODAY}" fi if [ -d "${TODAYD}/today" ] && STUFF=$(ls -X "${TODAYD}/today/") && [ -n "${STUFF}" ]; then echo \ and here\'s what to do: for CARD in ${STUFF}; do echo -n -e " * \033[1;33m(\033[1;37m${CARD}\033[1;33m)\033[0m " cat "${TODAYD}/today/${CARD}" done echo Good luck! else echo , don\'t you know what to do? =\) fi echo |
Adding a new task is as easy as typing something […]