[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: A feature proposal
From: |
Chet Ramey |
Subject: |
Re: A feature proposal |
Date: |
Sat, 05 Jan 2013 13:21:29 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/17.0 Thunderbird/17.0 |
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 chet@case.edu http://cnswww.cns.cwru.edu/~chet/