public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] [OT] Can bash do comments on files?
@ 2006-02-12 22:03 Alan E. Davis
  2006-02-12 22:17 ` Franta
  2006-02-12 22:27 ` Gerhard Hoogterp
  0 siblings, 2 replies; 12+ messages in thread
From: Alan E. Davis @ 2006-02-12 22:03 UTC (permalink / raw
  To: gentoo-user

I remember a little MSDOG shell utility called 4dos.  It alllowed me
to store comments that would appear alongside the filename.  Can
anyone point to a way to do this transparently and easily with bash? 
I don't want to run any extra programs if I can avoid it.  I do like
dired for emacs, though.

Thanks for any ideas.  I refer to this list because I can't think
where else to look.

Alan Davis

-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] [OT] Can bash do comments on files?
  2006-02-12 22:03 [gentoo-user] [OT] Can bash do comments on files? Alan E. Davis
@ 2006-02-12 22:17 ` Franta
  2006-02-12 22:27 ` Gerhard Hoogterp
  1 sibling, 0 replies; 12+ messages in thread
From: Franta @ 2006-02-12 22:17 UTC (permalink / raw
  To: gentoo-user

On Mon, 2006-02-13 at 08:03 +1000, Alan E. Davis wrote:
> I remember a little MSDOG shell utility called 4dos.  It alllowed me
> to store comments that would appear alongside the filename.  Can
> anyone point to a way to do this transparently and easily with bash? 
> I don't want to run any extra programs if I can avoid it.  I do like
> dired for emacs, though.
> 
> Thanks for any ideas.  I refer to this list because I can't think
> where else to look.
> 
> Alan Davis

Hi,

the idea is fine. How did DOS show the comments? ``dir /c'' ???
How would you like to see then with bash ``ls --comment'' ???

Hmmm.


-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] [OT] Can bash do comments on files?
  2006-02-12 22:03 [gentoo-user] [OT] Can bash do comments on files? Alan E. Davis
  2006-02-12 22:17 ` Franta
@ 2006-02-12 22:27 ` Gerhard Hoogterp
  2006-02-12 23:43   ` Alexander Skwar
  2006-02-12 23:47   ` Alan E. Davis
  1 sibling, 2 replies; 12+ messages in thread
From: Gerhard Hoogterp @ 2006-02-12 22:27 UTC (permalink / raw
  To: gentoo-user

On Sunday 12 February 2006 23:03, Alan E. Davis wrote:
> I remember a little MSDOG shell utility called 4dos.  It alllowed me
> to store comments that would appear alongside the filename.  Can
> anyone point to a way to do this transparently and easily with bash?
> I don't want to run any extra programs if I can avoid it.  I do like
> dired for emacs, though.

4dos (and 4NT, still use it daily on win2000) had to deal with 8.3 filenames.. 
So it used an index file named descript.ion. Under linux that's not nessecary 
as you can just use long filenames including spaces.. 

-- 
Ithaka photography, http://ithaka.mine.nu/
-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] [OT] Can bash do comments on files?
  2006-02-12 22:27 ` Gerhard Hoogterp
@ 2006-02-12 23:43   ` Alexander Skwar
  2006-02-12 23:47   ` Alan E. Davis
  1 sibling, 0 replies; 12+ messages in thread
From: Alexander Skwar @ 2006-02-12 23:43 UTC (permalink / raw
  To: gentoo-user

Gerhard Hoogterp wrote:

> 4dos (and 4NT, still use it daily on win2000) had to deal with 8.3 filenames.. 
> So it used an index file named descript.ion. Under linux that's not nessecary 
> as you can just use long filenames including spaces.. 

While all of that is certainly true, it doesn't help you at all,
if you wish to put a descriptive comment on a file. For example,
it's a rather bad idea to rename /etc/passwd just to have a
comment in the filename :)

Yes, symlinks exist, but that's still not the same.

No, I don't have an idea. Anything I can think of would require
patching "ls". And I don't think that this would be a clever
idea...

Alexander Skwar
-- 
When you die, you lose a very important part of your life.
		-- Brooke Shields
-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] [OT] Can bash do comments on files?
  2006-02-12 22:27 ` Gerhard Hoogterp
  2006-02-12 23:43   ` Alexander Skwar
@ 2006-02-12 23:47   ` Alan E. Davis
  2006-02-13  0:10     ` Iain Buchanan
  2006-02-13  5:34     ` [gentoo-user] " Moshe Kaminsky
  1 sibling, 2 replies; 12+ messages in thread
From: Alan E. Davis @ 2006-02-12 23:47 UTC (permalink / raw
  To: gentoo-user

On 2/13/06, Gerhard Hoogterp <gerhard@frappe.xs4all.nl> wrote:
> Under linux that's not nessecary
> as you can just use long filenames including spaces..
>

I do that, of course.   It solves 95% of my issues.  Somehow, I still
miss that feature.  Additional comments would help me, for example,
when I have a series of source code files with similar file names, and
need to make comments to distinguish them.  Especially when other
programs are looking for the file names in a series.

Alan

-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] [OT] Can bash do comments on files?
  2006-02-12 23:47   ` Alan E. Davis
@ 2006-02-13  0:10     ` Iain Buchanan
  2006-02-13  0:21       ` John Jolet
  2006-02-13  5:34     ` [gentoo-user] " Moshe Kaminsky
  1 sibling, 1 reply; 12+ messages in thread
From: Iain Buchanan @ 2006-02-13  0:10 UTC (permalink / raw
  To: gentoo-user

On Mon, 2006-02-13 at 09:47 +1000, Alan E. Davis wrote:
> On 2/13/06, Gerhard Hoogterp <gerhard@frappe.xs4all.nl> wrote:
> > Under linux that's not nessecary
> > as you can just use long filenames including spaces..
> >
> 
> I do that, of course.   It solves 95% of my issues.  Somehow, I still
> miss that feature.  Additional comments would help me, for example,
> when I have a series of source code files with similar file names, and
> need to make comments to distinguish them.  Especially when other
> programs are looking for the file names in a series.

The simplest way I can see to do it, would be to:
- make a bash script called "ls"
- put it in your ~/bin directory (not in /bin)
- make an alias to _your_ ls, which first checks for a descript.ion file
or maybe even .comments file in the current directory, and then passes
the rest to ls.

A bit of fiddling, but that's what linux is about - if it doesn't work
the way you want it: make it work the way you want it!!

Let me know if you want to know more about this method.

-- 
Iain Buchanan <iain at netspace dot net dot au>

Obviously your filters are throwing away mail from Randal.  :-)
             -- Larry Wall in <199710221937.MAA25131@wall.org>

-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] [OT] Can bash do comments on files?
  2006-02-13  0:10     ` Iain Buchanan
@ 2006-02-13  0:21       ` John Jolet
  2006-02-13  4:32         ` Iain Buchanan
  0 siblings, 1 reply; 12+ messages in thread
From: John Jolet @ 2006-02-13  0:21 UTC (permalink / raw
  To: gentoo-user




On 2/12/06 6:10 PM, "Iain Buchanan" <iaindb@netspace.net.au> wrote:

> On Mon, 2006-02-13 at 09:47 +1000, Alan E. Davis wrote:
>> On 2/13/06, Gerhard Hoogterp <gerhard@frappe.xs4all.nl> wrote:
>>> Under linux that's not nessecary
>>> as you can just use long filenames including spaces..
>>> 
>> 
>> I do that, of course.   It solves 95% of my issues.  Somehow, I still
>> miss that feature.  Additional comments would help me, for example,
>> when I have a series of source code files with similar file names, and
>> need to make comments to distinguish them.  Especially when other
>> programs are looking for the file names in a series.
> 
> The simplest way I can see to do it, would be to:
> - make a bash script called "ls"
> - put it in your ~/bin directory (not in /bin)
> - make an alias to _your_ ls, which first checks for a descript.ion file
> or maybe even .comments file in the current directory, and then passes
> the rest to ls.
You know...now that you put it that way, I seem to recall seeing a project
in freshmeat that did something like that....
> 
> A bit of fiddling, but that's what linux is about - if it doesn't work
> the way you want it: make it work the way you want it!!
> 
> Let me know if you want to know more about this method.


-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] [OT] Can bash do comments on files?
  2006-02-13  0:21       ` John Jolet
@ 2006-02-13  4:32         ` Iain Buchanan
  2006-02-13  7:10           ` Iain Buchanan
  0 siblings, 1 reply; 12+ messages in thread
From: Iain Buchanan @ 2006-02-13  4:32 UTC (permalink / raw
  To: gentoo-user

On Sun, 2006-02-12 at 18:21 -0600, John Jolet wrote:
> On 2/12/06 6:10 PM, "Iain Buchanan" <iaindb@netspace.net.au> wrote:
> 
> > On Mon, 2006-02-13 at 09:47 +1000, Alan E. Davis wrote:
> >> On 2/13/06, Gerhard Hoogterp <gerhard@frappe.xs4all.nl> wrote:
> >>> Under linux that's not nessecary
> >>> as you can just use long filenames including spaces..
> >>> 
> >> 
> >> I do that, of course.   It solves 95% of my issues.  Somehow, I still
> >> miss that feature.
> > 
> > The simplest way I can see to do it, would be to:
> > - make a bash script called "ls"
> > - put it in your ~/bin directory (not in /bin)
> > - make an alias to _your_ ls, which first checks for a descript.ion file
> > or maybe even .comments file in the current directory, and then passes
> > the rest to ls.
> 
> You know...now that you put it that way, I seem to recall seeing a project
> in freshmeat that did something like that....

just for fun, I wrote this leedle script with my trusty glass hammer,
left handed screw driver, and can of 3mm holes.  Call it "ls" and put it
in ~/.bin or something similar.  It's not ideal but its a nice start if
you want to go further...

#!/usr/bin/perl -w

use strict;

my %files;

for my $i (0 .. $#ARGV) {
    # print "$ARGV[$i] ";
    if ($ARGV[$i] !~ /^-/) {
	$files{$ARGV[$i]} = '';
    }
}

# for my $i (sort keys %files) {
#     print "'$i': '" . $files{$i} . "'\n";
# }

for my $i (sort keys %files) {
    $files{$i} = [ `dirname $i`, `basename $i`];
    chomp $files{$i}->[0];
    chomp $files{$i}->[1];
    # print 'file is ' . $files{$i}->[0] . ' ' . $files{$i}->[1] . "\n";

    my $command = 'cat ' . $files{$i}->[0] . '/.comment 2>/dev/null | egrep "^' . $files{$i}->[1] . ' "';
    # print "$command\n";
    print `$command`;
}

print `/usr/bin/ls @ARGV\n`;

-- 
Iain Buchanan <iain at netspace dot net dot au>

Soap and education are not as sudden as a massacre, but they are more
deadly in the long run.
		-- Mark Twain

-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [gentoo-user] Re: [OT] Can bash do comments on files?
  2006-02-12 23:47   ` Alan E. Davis
  2006-02-13  0:10     ` Iain Buchanan
@ 2006-02-13  5:34     ` Moshe Kaminsky
  2006-02-13 12:03       ` Mrugesh Karnik
  1 sibling, 1 reply; 12+ messages in thread
From: Moshe Kaminsky @ 2006-02-13  5:34 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1120 bytes --]

* Alan E. Davis <lngndvs@gmail.com> [13/02/06 02:08]:
> 
> On 2/13/06, Gerhard Hoogterp <gerhard@frappe.xs4all.nl> wrote:
> > Under linux that's not nessecary
> > as you can just use long filenames including spaces..
> >
> 
> I do that, of course.   It solves 95% of my issues.  Somehow, I still
> miss that feature.  Additional comments would help me, for example,
> when I have a series of source code files with similar file names, and
> need to make comments to distinguish them.  Especially when other
> programs are looking for the file names in a series.

You can use extended attributes for this. See getfattr(1) and attr(5) 
from sys-apps/attr. I think you need to enable this for the file system 
you are using when compiling the kernel (and maybe also pass the 
"use_xattr" option when mounting)

HTH,
Moshe
> 
> Alan
> 
> -- 
> gentoo-user@gentoo.org mailing list
> 

-- 
I love deadlines. I like the whooshing sound they make as they fly by. 
                                        -- Douglas Adams
    
    Moshe Kaminsky <kaminsky@math.huji.ac.il>
    Home: 08-9456841


[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] [OT] Can bash do comments on files?
  2006-02-13  4:32         ` Iain Buchanan
@ 2006-02-13  7:10           ` Iain Buchanan
  0 siblings, 0 replies; 12+ messages in thread
From: Iain Buchanan @ 2006-02-13  7:10 UTC (permalink / raw
  To: gentoo-user

On Mon, 2006-02-13 at 14:02 +0930, Iain Buchanan wrote:
> just for fun, I wrote this leedle script

I should have explained it a bit more - the script looks for a .comment
file, and matches the first word in that file.  Anything after this word
is a "comment" for the file.

so if you said ~/.bin/ls -al foobar

and the file .comment existed, containing:
foobar this is a comment

the output would be:
foobar this is a comment
-rw------- 1 iain users 4668 2006-01-03 17:32 foobar

You could then alias it, so instead of type ~/.bin/ls you could just
type ls.
-- 
Iain Buchanan <iain at netspace dot net dot au>

A friend in need is a pest indeed.

-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [gentoo-user] Re: [OT] Can bash do comments on files?
  2006-02-13  5:34     ` [gentoo-user] " Moshe Kaminsky
@ 2006-02-13 12:03       ` Mrugesh Karnik
  2006-02-13 13:27         ` Moshe Kaminsky
  0 siblings, 1 reply; 12+ messages in thread
From: Mrugesh Karnik @ 2006-02-13 12:03 UTC (permalink / raw
  To: gentoo-user

On Monday 13 February 2006 11:04, Moshe Kaminsky wrote:

> You can use extended attributes for this. See getfattr(1) and attr(5)
> from sys-apps/attr.

Quoting the man page for attr:

Extended attributes implement the ability for a user to attach name:value 
pairs to objects within the _XFS_ filesystem.

Does it work for other file systems?

Mrugesh
-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [gentoo-user] Re: [OT] Can bash do comments on files?
  2006-02-13 12:03       ` Mrugesh Karnik
@ 2006-02-13 13:27         ` Moshe Kaminsky
  0 siblings, 0 replies; 12+ messages in thread
From: Moshe Kaminsky @ 2006-02-13 13:27 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1024 bytes --]

* Mrugesh Karnik <mrugeshkarnik@gmail.com> [13/02/06 14:15]:
> 
> On Monday 13 February 2006 11:04, Moshe Kaminsky wrote:
> 
> > You can use extended attributes for this. See getfattr(1) and attr(5)
> > from sys-apps/attr.
> 
> Quoting the man page for attr:
> 
> Extended attributes implement the ability for a user to attach name:value 
> pairs to objects within the _XFS_ filesystem.

I believe you are looking at the man page for the attr command (attr(1)) 
rather than attr(5), which states that attributes are implemented for 
ext2, ext3 and xfs. I believe they are also implemented for reiserfs 
since the option exist in the kernel configuration, but I'm not sure.

Moshe

> 
> Does it work for other file systems?
> 
> Mrugesh
> -- 
> gentoo-user@gentoo.org mailing list
> 

-- 
I love deadlines. I like the whooshing sound they make as they fly by. 
                                        -- Douglas Adams
    
    Moshe Kaminsky <kaminsky@math.huji.ac.il>
    Home: 08-9456841


[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2006-02-13 13:31 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-12 22:03 [gentoo-user] [OT] Can bash do comments on files? Alan E. Davis
2006-02-12 22:17 ` Franta
2006-02-12 22:27 ` Gerhard Hoogterp
2006-02-12 23:43   ` Alexander Skwar
2006-02-12 23:47   ` Alan E. Davis
2006-02-13  0:10     ` Iain Buchanan
2006-02-13  0:21       ` John Jolet
2006-02-13  4:32         ` Iain Buchanan
2006-02-13  7:10           ` Iain Buchanan
2006-02-13  5:34     ` [gentoo-user] " Moshe Kaminsky
2006-02-13 12:03       ` Mrugesh Karnik
2006-02-13 13:27         ` Moshe Kaminsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox