On 8/22/06, Martin Bähr <[EMAIL PROTECTED]> wrote:
> On Tue, Aug 22, 2006 at 03:33:05PM +0200, Martin Bähr wrote:
> > syntax elements that look the same as in posix shell, should also
> > behave like that. (i don't think that is being violated anywhere else
> > in fish)
>
> actually i am wrong on this one:
> () in bash/posix is used for subshells, while in fish it is used for
> inserting the output of commands into an argument.
>
> and since i really like how fish does that i think the above rule
> should not be taken to strictly :-)

Good counterpoint to your own point. ;-)

>
> i do however simply have an issue with the syntax of "2>&1"
> i find it unintuitive and hard to read (in part given by the other use of &

Yes, it's not a thing of beauty, I'll give you that. I couldn't come
up with something significantly better, so I used the Posix syntax.

>
> use something different?
>
> 2>+1
> or
> 2>-1

The latter looks too much of >&-, used for closing an fd. And though I
may agree that '-' is easier on the eyes than '&', it's not enough of
an improvement to move away from Posix behaviour, IMO. There is no
syntactic benefit that I can see.

>
> or how about trying to come up with a uniform way to specify numbered file
> descriptors? (like %foo is a job, <something>foo could be a file descriptor)

Using '2>&stdout' to redirect stderr to stdout is doable, and much
more readable. As a bonus it is also backwards compatible with Posix.
One could further extend this to support 'stderr>&stdout'. The major
snag I see is with whitespace sensitivity. While fish allows you to
have a space after the '>', you can't have one before:

echo foo >bar #Write foo to file bar
echo foo > file #Write foo to file bar
echo foo>bar #Write newline, redirect fd named foo to file bar
echo foo> bar #Write newline, redirect fd named foo to file bar

>
> currently there are two ways:
>
> 2 > &1
>     ^^ filedescriptor after redirection
> ^ filedescriptor being redirected
>
> uniform would be:
> &2>&1
> but that's ugly because of the &

More uniform, yes. But the extra '&' doesn't disambiguate anything, so
there is a reasoanble argument against it as well.

>
> drop them both?
> 2>1
> then you get a problem with numbers meaning filenames.

That is bad.

>
> +2>+1
> or
> -2>-1
> since - is a shortcut for stdout this could make sense

But it gives us trouble with closing file descriptors.

>
> or one of these:
> #2>#1 @2>@1 *2>*1 ~2>~1 !2>!1 =2>=1 :2>:1

# is a comment
@ is free
* is a wildcard
~ is $HOME
! is free, but might be used for something history-ish in ther future
= is free
: is free

The operators that are already taken _might_ be possible to overload
in a non-ambigous fashion, but I'd rather not.

>
> somehow :2>:1 looks nicest from all the options...
>
> what do you think?

I like the named file descriptors idea, but the whitespace sensitivity
issue is a big problem for it. Other than that, even while I
absolutley agree that the '&' is ugly, I don't think this is a big
enough problem to warrant Posix incompatibility.

>
> 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