#
# showp:    Show all currently defined project directories, in reverse
#           chronological order (by definition date).
# Written by Leor Zolman, 10/92
# Supports project numbers up to 99 as written.
# Uses PROJDIR variable defined and exported by login startup script.
#

projlist=`ls -t $PROJDIR/Proj* 2>&1`
if [ $? -ne 0 ]; then
    echo "There are no project directories defined."
    return
fi

newest=`echo "$projlist" | head -1`
 
ls $PROJDIR/Proj* | 
    awk '{
        pos = length($1)
        while ((c = substr($1, pos-1, 1)) >= "0" && c <= "9")
            pos--;
        printf "echo \"%s Project #%d = `cat %s` \"\n",
            (($1 == newest) ? " -->" : "    "), substr($1, pos), $1
    }' newest="$newest" |  sh
