Skip to content

Instantly share code, notes, and snippets.

@melnik13 melnik13/.bash_today
Last active Aug 29, 2015

Embed
What would you like to do?
.bash_today: This simple script lists today’s tasks every time you log in (or create a new window in your screen)
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.