Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: zle separability
- X-seq: zsh-workers 21192
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: zle separability
- Date: Mon, 25 Apr 2005 16:09:27 +0000
- In-reply-to: <20050425075146.GC28168@xxxxxxxxxxxxxx>
- 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>
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. 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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author