zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@brasslantern.com>
To: Zsh Development Workers <zsh-workers@sunsite.auc.dk>
Subject: Re: Two questions
Date: Tue, 26 Jan 1999 22:36:51 -0800	[thread overview]
Message-ID: <990126223651.ZM26737@candle.brasslantern.com> (raw)
In-Reply-To: <19990126183201.A27794@fysh.org>

On Jan 26,  6:32pm, Phil Pennock wrote:
} Subject: Two questions
}
} A few weeks ago I queried (on zsh-users) how to do redirection from a
} variable file descriptor.  The answer was quite complex, and boiled down
} to the fact that the parser gets in the way.
} 
} Bog-standard Bourne shell handles it smoothly.  If we're aiming for
} compatibility, fixing this might be good.  How feasible is it?
} 
} Eg,
} % cat foo
} #!/path/to/zsh -f
} print >$1 '=== Foo! ==='

Shouldn't that be

	print >&$1 '=== Foo! ==='

(note `&')?  Otherwise you're redirecting to the file named $1, not to
the descriptor numbered $1.

} % ./foo 5 5>Funky

I just tried the following little function:

    tryit() {
	echo No parameter 1>&2
	echo Parameter: $1>&$2
    }

Any of bash, zsh 3.0.5, and zsh-3.1.5-pws-5 give exactly the same result:
The output is correctly redirected to the descriptor on the right-hand
side of the redirection, even when that descriptor is named in a variable,
but a variable on the left-hand side of the redirection simply becomes
another argument to the echo.  E.g.,

    zagzig% tryit 5 1
    No parameter
    Parameter: 5
    zagzig% tryit 2 5
    No parameter
    zsh: 5: bad file number
    zagzig% tryit 2 5 5>/dev/null
    No parameter
    zagzig%

Now, are you certain that "bog-standard Bourne shell" does the thing you
wanted with descriptors on both/either sides of the redirection operator?

} Recently zsh has changed a number of things to be more compatible with
} ksh.  And some things, such as the associative arrray stuff, has
} followed what seem to be dubious criteria in order to be compatible.

Could you please describe which "dubious criteria" you mean?  Other than
the fact that we now have conflicting meanings of the -A option for some
nominally related commands, I thought we were doing pretty well with the
associative array stuff.

} Given that there's pdksh for that, just how important is it for zsh to
} parallel ksh?

Not that I'm really in the compatibily camp, but the argument goes a bit
like this:

Lots and lots of shell scripts -- particularly system init scripts and
components of GNU utilities -- are written to work with bash and/or ksh.
If zsh can't interpret those scripts, lots of things go wrong; /bin/sh
can't be a link to zsh, some "make" tools that don't properly reset
$(SHELL) will break for people who use zsh, and so forth.  Every such
bit of breakage is an obstacle to getting zsh installed and used on the
machine where it happens.  In extreme cases there are even disk space
or memory usage issues that limit the number of shells that can be made
available; if zsh can't reliably interpret critical shell scripts, it
will be removed in favor of a shell that can, even if interactive users
suffer as a result.  Therefore, zsh must always be a superset of other
Bourne-like shells, not just in function but also in form.

} And how important to do so natively, as opposed to an option adding
} behaviour or whatever?

Here I'm of the opinion that the number of options has already gotten
out of hand and very close scrutiny should be applied to new ones.  That
means that if you're adding something that another Bourne-like shell has
already implemented, do it the same way as that other shell UNLESS that
already conflicts with an established zsh usage.  In that case only, an
option could be considered (and the established zsh usage should remain
the default).

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


  reply	other threads:[~1999-01-27  6:36 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-01-26 18:32 Phil Pennock
1999-01-27  6:36 ` Bart Schaefer [this message]
1999-01-27 10:59   ` Phil Pennock
1999-01-27 11:13     ` Geoff Wing
1999-01-27 11:33       ` Bruce Stephens
1999-01-27 12:46       ` Peter Stephenson
1999-01-27 11:28     ` Bruce Stephens
1999-01-27 14:11       ` Phil Pennock
1999-01-27 18:25         ` Bart Schaefer
2000-04-06  8:39 Sven Wischnowsky
2000-04-06  9:55 ` Bart Schaefer
2000-04-06 10:36   ` Andrej Borsenkow
2000-04-06 10:42 Sven Wischnowsky
2000-04-06 15:56 ` Bart Schaefer
2000-04-06 16:44   ` Zefram
2004-03-02 10:47 Two Questions Nikolai Weibull

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=990126223651.ZM26737@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).