On 8/17/06, Martin Baehr <[EMAIL PROTECTED]> wrote:
> On Thu, Aug 17, 2006 at 04:37:17PM +0200, Axel Liljencrantz wrote:
> > You can usually use e.g. 'ls *foo{1,2,3,4,5}' or 'ls ?oo{1,2,3,4,5}'
> > instead of 'ls foo[12345]', though this obviously relies on either
> > there being no files like 'aaafoo3' or 'boo2', respectively.
>
> ah, i'll have to remember that. thankfully it is easy to verify if the
> choice is correct with tab completion working on wildcards. something
> that was always a pain in bash. when the wildcards became to complex i
> had to replace the command that i wanted to run with ls, to make sure
> the right choice was made, and then redo it with the real command.
>
> another score for fish.

:D

>
> > Yes. Multiline editing on the commandline has been on my todo-list for
> > a very long time. I do hope to have the time to do this soon, but I
> > have been hoping for a long time.
>
> hmm, i didn't think of that as multiline editing, but just multiline input.
> multiline editing implies being able to go back and edit previous lines,
> just like in an editor window. i do hope the latter is your goal,
> because that would really be an outstanding feature. the former though
> would be nice as a quick fix.

The latter is the plan. Though, as I said, it has been so for a long time... :-/

>
> > The second issue is a bit muddy for me. On one hand, it seems more
> > intuitive to fail on the first failed substitution. On the other hand,
> > wildcards only fail if all a commands wildcard fail, so that would be
> > more consistent.
>
> well, for the (isfile ...) example, there is nothing stopping me to
> apply it to all wildcards, even the easy ones:
> > foo (isfile foo{1,2,3} bar*)
> even though checking on bar is redundant
>
> whereas
> > foo (isfile foo{1,2,3}) bar*
> will fail even if isfile does deliver results
>
> on a related note a command like:
> > foo -a foo* -b bar*
> should fail even if one of those wildcards does deliver results.
> which currently is not the case. the argument here is that, these are
> two seperate file lists, and one of them is empty while
> > foo foo* bar*
> is only one filelist which will not be empty unless both arguments are
> empty.
>
> the trouble is of course, how to know if -b is not maybe a filename too.
> so i realize that the answer here might not be so easy.

As you note, when it comes to wildcards, either behaviour can be the
more desirable. I seem to remember the disussion of the correct
behaviour coming up, and the motivation for choosing the current
behaviour was:

* compatibility, this is how other shells that skip commands with
failed globs do it.
* things like 'for i in *.jpg *.png; ...; end' are relatively common,
while the cases you describe above are slightly less so.

The latter point may not be true for everybody, but it seemed the
consensus at the time, and I have found that it works fairly well. In
cases where you want to fail on either wildcard, you will have to do
something like:

set wc1 foo*; and set wc2 bar*; and foo -a $wc1 -b $wc2

which I admit is a bit wordy, but still pretty readable.

In an ideal world, it would be possible to make a clever heuristic to
detect when a single wildcard is enough to cause failiure and when all
wildcards must fail. In reality, I think that any such rule would be
so complex that it would sometimes yield surprising results which in
turn cause subtle bugs. In the end, I belive a very simple rule that
is predictable and works reasonably often is the best choice.

>
> greetings, martin.
> --
> cooperative communication with sTeam      -     caudium, pike, roxen and unix
> offering: programming, training and administration   -  anywhere in the world
> --
> pike programmer   travelling and working in europe             open-steam.org
> unix system-      bahai.or.at                        iaeste.(tuwien.ac|or).at
> administrator     (caudium|gotpike).org                          is.schon.org
> Martin Bähr       http://www.iaeste.or.at/~mbaehr/
>


-- 
Axel

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to