bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: feature request: file_not_found_handle()


From: Ken Irving
Subject: Re: feature request: file_not_found_handle()
Date: Wed, 21 Aug 2013 13:12:23 -0800
User-agent: Mutt/1.5.20 (2009-06-14)

On Wed, Aug 21, 2013 at 08:10:50AM -0400, Greg Wooledge wrote:
> On Wed, Aug 21, 2013 at 02:22:24AM -0800, Ken Irving wrote:
> >     $ cat $(ambler.method dispatch)
> >     #!/bin/bash
> >     method=$1 && shift
> >     test -n "$method" || exit
> >     for s in $(ls|shuf); do
> >         tob $s.$method "$@" &
> >     done
> 
> As far as I can tell, this is some incredibly stupid crap thrown together
> by an "object oriented" junkie to try to make one language look like some
> other language.  That is ALWAYS a bad idea.

The point is not to 'make' bash look like anything else, it is rather to use
the filesystem and bash as tools to do things.  It's an experimental system,
one that interests me, seems to work, and I don't think it necessary does
harm to those that don't use it.

> If you want to do a "method" to an "object", bash already provides a
> syntax for that:
> 
>   method object
> 
> Not:
> 
>   object.method
> 
> The latter is ass-backwards.  It's simply ludicrous.  Stop it.
 
I've found that it can work and can be useful, but am not surprised
at the vitriol you express.  Is that sufficient reason to not even
consider providing a hook to handle forms like dir/object.method?
That is the issue.

> Now, look at this crap:
> 
> >     for s in $(ls|shuf); do
> 
> Do you know how hard we work every day to try to stamp out these sorts
> of bugs?  This is so bad I'm laugh/crying right now.

Yes I do have some idea.  I read the bash-bug list regularly, and many
times (even if you can't tell) refer to the wiki you host, read the FAQs,
RTFMs, try to absorb what wisdom I can, and in general try to improve on
the bash coding I do use.  But this was a simple case where there are no
spaces in the names, I wanted to handle the contents of the directory in
more or less random order, and this was a simple if stupid way to do that.
 
> touch 'this is a filename with spaces'

    $ ambler.touch 'this is a filename with spaces'
    
    $ ambler.ls -l
    total 0
    lrwxrwxrwx 1 site site  8 Oct 13  2012 dam5 -> ../wild/
    lrwxrwxrwx 1 site site 17 Oct 13  2012 dam6 -> ../upper-iniakuk/
    lrwxrwxrwx 1 site site 14 Oct 13  2012 dam7 -> ../upper-reed/
    lrwxrwxrwx 1 site site 19 Jul 31 12:12 dam8 -> ../upper-kogoluktuk
    lrwxrwxrwx 1 site site 11 Oct 13  2012 das1 -> ../bettles/
    lrwxrwxrwx 1 site site 10 Oct 13  2012 das2 -> ../alatna/
    lrwxrwxrwx 1 site site  9 Oct 13  2012 das3 -> ../sfork/
    lrwxrwxrwx 1 site site  8 Oct 13  2012 das4 -> ../reed/
    -rw-r--r-- 1 site site  0 Aug 21 10:59 this is a filename with spaces
    
    $ ambler.dispatch types
    CR1000-Data-Archive:Directory:Object
    CR1000-Data-Archive:Directory:Object
    CR1000-Data-Archive:Directory:Object
    CR1000-Data-Archive:Directory:Object
    CR1000-Data-Archive:Directory:Object
    CR1000-Data-Archive:Directory:Object
    CR1000-Data-Archive:Directory:Object
    CR1000-Data-Archive:Directory:Object
    chained method a did not resolve
    chained method is did not resolve
    chained method this did not resolve
    chained method with did not resolve
    chained method filename did not resolve
    chained method spaces did not resolve
    
    $ ambler.rm 'this is a filename with spaces'

There is no reason that names with spaces could not be used, I just
have no interest in using them myself, and have not bothered with
supporting them.  If the system did support them, then it would either
work or maybe would report that 'this is a filename with spaces' does not
have that method.  Obviously the dispatch method would need to be fixed,
but other than just: 'for s in *; do "$s.$method"; done', I'd need to look
up how to shuffle up the names, e.g., probably use a while loop with the
shuffling done in a pipe at the end, or put the names in an array, etc..
That's all doable, but it wasn't necessary to do for this case.

And that is all well beside the point, which is whether a
No_such_file_or_directory_handler hook (or equivalent) might be provided.

Ken




reply via email to

[Prev in Thread] Current Thread [Next in Thread]