Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: some way to inherit kill ring in su'd shell?
- X-seq: zsh-users 13694
- From: Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx>
- To: Zsh users <zsh-users@xxxxxxxxxx>
- Subject: Re: some way to inherit kill ring in su'd shell?
- Date: Sat, 10 Jan 2009 01:52:32 -0800
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=d200807; d=spodhuis.org; h=Received:Date:From:To:Subject:Message-ID:Mail-Followup-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; b=BoL31gt2dK9j/LsZYQoW0Odr+R5DiRh0Wp93rWJSKJEG2ulZ14bGmLd+/X/4SgVQlGkmcfyhurZenAyP0GpHqgZoXlYV1puHM3chi7o3bbXjgUIM3NDNIueeuGWcaHxNtL6G6b2h1KkKTD6KI27a4yDydxMYlD+DgpBuuLifGa8=;
- In-reply-to: <18789.30656.261463.382208@xxxxxxxxxxxxxxxxxx>
- Mail-followup-to: Zsh users <zsh-users@xxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <18789.30656.261463.382208@xxxxxxxxxxxxxxxxxx>
On 2009-01-07 at 22:49 -0500, Greg Klanderman wrote:
> Is there some way to have the shell started by su inherit
> the kill ring from the parent shell?
Grotesque and there's probably a more elegant way which I'm missing, but
you could rebind ^M from accept-line to a custom widget which does some
dispatch checks before calling the accept-line widget; your custom
widget checks for the first word not containing '=' within it and takes
that as the command-word (also handle leading '-' appropriately, as
appropriate for your command-line style).
You then dispatch on the command-word; if it's su then you dump the
contents of the killring array variable (available in widget context)
with 'typeset -p killring' to a file with a fixed name in a place only
writable by the invoking user but readable by the recipient user -- be
very careful of FS attacks here. In the target user shell startup
(.zshrc), do something like check if the file is less than a minute old
and, if so, source it. Preferably with some paranoid ownership checks
too.
-Phil
Messages sorted by:
Reverse Date,
Date,
Thread,
Author