Re: [gentoo-user] [OT] Can bash do comments on files?
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 A friend in need is a pest indeed. -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] [OT] Can bash do comments on files?
On Sun, 2006-02-12 at 18:21 -0600, John Jolet wrote: > On 2/12/06 6:10 PM, "Iain Buchanan" <[EMAIL PROTECTED]> wrote: > > > On Mon, 2006-02-13 at 09:47 +1000, Alan E. Davis wrote: > >> On 2/13/06, Gerhard Hoogterp <[EMAIL PROTECTED]> 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 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
Re: [gentoo-user] [OT] Can bash do comments on files?
On 2/12/06 6:10 PM, "Iain Buchanan" <[EMAIL PROTECTED]> wrote: > On Mon, 2006-02-13 at 09:47 +1000, Alan E. Davis wrote: >> On 2/13/06, Gerhard Hoogterp <[EMAIL PROTECTED]> 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
Re: [gentoo-user] [OT] Can bash do comments on files?
On Mon, 2006-02-13 at 09:47 +1000, Alan E. Davis wrote: > On 2/13/06, Gerhard Hoogterp <[EMAIL PROTECTED]> 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 Obviously your filters are throwing away mail from Randal. :-) -- Larry Wall in <[EMAIL PROTECTED]> -- gentoo-user@gentoo.org mailing list
Re: [gentoo-user] [OT] Can bash do comments on files?
On 2/13/06, Gerhard Hoogterp <[EMAIL PROTECTED]> 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
Re: [gentoo-user] [OT] Can bash do comments on files?
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
Re: [gentoo-user] [OT] Can bash do comments on files?
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
Re: [gentoo-user] [OT] Can bash do comments on files?
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