On 1/5/13 4:06 AM, yati sagade wrote:
> Hi
> I have found many a time that in my huge home directory tree, I forget what
> directory contains exactly what. e.g., in ~/Projects/ml/py I might keep the
> solutions to my machine learning course I wrote in Python, but sometimes,
> we all can be bit shaky with naming directories and later have to hunt for
> something when we need it.
> 
> What if a directory could optionally contain a special file, say,
> ".__about__ ",  which contains a brief summary of what this directory
> contains. Then, the flow could be
> 
> 
>    - Create a directory optionally with a message
> 
>              $ mkdir -p foo/bar --about "Example directory".
> 
>    - The cd builtin, depending upon an environment variable or an option,
>    also cats the .__about__ file after performing the chdir.
> 
> $ cd --about foo/bar
> 
>               foo/bar: Example directory

This is off-the-cup and incomplete, but you get the idea.

cd()
{
        about=false
        case "$1" in
        --about)        about=true ; shift ;;
        esac

        builtin cd "$@"
        rv=$?

        (( $rv == 0 )) && $about && [ -f .__about__ ] && cat .__about__

        return $rv
}

We don't need to be so eager to embed this kind of stuff in C code.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    c...@case.edu    http://cnswww.cns.cwru.edu/~chet/

Reply via email to