Zsh Mailing List Archive
Messages sorted by:
Re: zle separability
- X-seq: zsh-workers 21200
- From: Frederik Eaton <frederik@xxxxxxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: zle separability
- Date: Wed, 27 Apr 2005 22:59:54 -0700
- Cc: zsh-workers@xxxxxxxxxx
- In-reply-to: <1050425160927.ZM24988@xxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20050424193737.GA27777@xxxxxxxxxxxxxx> <20050424230816.GA78@DervishD> <20050425075146.GC28168@xxxxxxxxxxxxxx> <20050425104950.GA4108@DervishD> <20050425110410.GD28168@xxxxxxxxxxxxxx> <20050425113925.GA4578@DervishD> <20050425115849.GA17635@xxxxxxxxxxxxxx> <1050425160927.ZM24988@xxxxxxxxxxxxxxxxxxxxxxx>
- Reply-to: frederik@xxxxxxx
On Mon, Apr 25, 2005 at 04:09:27PM +0000, Bart Schaefer wrote:
> On Apr 25, 12:51am, Frederik Eaton wrote:
> } Thanks. I guess there's always writing a zsh script to do the
> } interfacing, but that wouldn't be ideal.
> The Functions/Misc/nslookup script in the zsh distribution is the
> classic example of doing this. If your underlying command doesn't
> expect to print its own prompts on a terminal, you can even leave
> out the zpty stuff and just do a "while vared" loop.
> } (... but, by the way, it would still be nice if such uses for zsh were
> } better supported, with for instance support for reading an arbitrary
> } config file or executing an arbitrary fragment before opening an
> } interactive shell, or for a function which can be defined to handle
> } all interactive commands)
> Interactive shells are for interacting with the shell. You don't need
> an interactive shell to interact with some other command.
Well on a computer you don't *need* anything to do anything. But it's
come up for me before that this would be a very convnient way of doing
certain things. If you want a command which will start a normal zsh
but with a certain environment, you can set the variables and hope the
user's .zshrc doesn't overwrite them. But this isn't ideal, and it
doesn't allow you to configure aliases or functions.
It's not a big deal, I don't know how many others would use it, but I
was surprised to find out that it wasn't a feature.
I have this at the end of my .zshrc, but the fact that it's not
standard (and I would choose a different variable name if it were)
means that there are drawbacks to relying on it in anything I
distribute to others.
if [ -n $RC_CMD ]; then
> E.g. to repeatedly read command-line arguments of "dig" and then
> call dig with those arguments:
> zsh -c 'while line=""; vared -e -p "$0: " line; do $0 $=line; done' dig
> The use of $0 means you can replace "dig" above with any other command
> name and it'll work the same way. It's a little trickier if you want
> to add history support, but not too bad.
Can you describe how history support might be added?
Messages sorted by: