# source this file from your profile file # remember to set THISWEEK environment variable to point base directory for "this week" work thisweek() { local target="${THISWEEK}/$(date +%y%V)" if [ ! -d $target ]; then mkdir -p $target fi echo $target } twseparator() { echo -e "\n-----------------------------------------------------------\n" } twls() { local target=$(thisweek) local log=$target/journal.txt if [ -f $log ]; then cat $log fi twseparator ls -AkhotFL --group-directories-first $target } tw() { local target=$(thisweek) cd $target twls } twlog() { if [ -n "$1" ]; then local log=$(thisweek)/journal.txt if [ ! -f "$log" ]; then ncal -hw3 >> $log twseparator >> $log fi local when=$(date +"%d.%m.%Y %H:%M") echo "${when} -- ${*}" >> $log fi } twed() { $EDITOR $(thisweek)/journal.txt } twln() { local here=$(pwd -P) local base=$(basename $here) local target=$(thisweek)/$base if [ ! -e "$target" ]; then ln -s $here $target twlog "Symlinked $here as $base." fi cd $target }