#!/bin/bash [ "$1" = "usage" ] && echo " lb proj|con" && echo " List by project or context" && exit 0 shift type=$1 first="true" for i in $(todo.sh list$type) do #echo a newline before every $type, except the first [ "$first" = "true" ] && first=0 || echo #color the header if [ "$type" = "proj" ] then #this is a very nasty hack echo -ne $(echo -ne "$COLOR_PROJECT") elif [ "$type" = "con" ] then #still a nasty hack echo -ne $(echo -ne "$COLOR_CONTEXT") fi echo "$i:" #the actual header tput sgr0 #clear color "$TODO_FULL_SH" ls "$i" | #remove todo.sh footer and indent lines sed '/--/d;/TODO: [0-9]/d;s/^/ /g' done