Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: allow zsh to source a script and then become interactive
- X-seq: zsh-users 22665
- From: Anthony Fletcher <anthony@xxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: allow zsh to source a script and then become interactive
- Date: Fri, 14 Apr 2017 18:03:42 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bifb-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=R4wEsf7vSUDhMTvkt2rgQr0XtPb/UeGOihTrCEY7IoA=; b=yvM1wRa3NO0lHVcgQmIo4EYQ2PmDQsaMHC83A8YWhZqIwtVv9Ucfu7s8th+7f49Vno qAKFBLsiy4w5B2hQLl+MRvVz4P/MgAodhb5E7Ncihz538EzizFTcDmDXvXfMP9dFI85H TQ44U5dlxH4fQCBf/3C8tHssnQWmUciO1eiVxLLMuaMTbs3GFA/4ilHZRN4fP/Hoak5b ovxlvRhUk/yX3d44OsXRSEayxcPQS30cHixB7xIkspfzSxT1njksX9t0XgMnsj9tB1vW RpEGb1VKArt+oe3SPJIzLPmT++F8PyoqBkmg+E62z+V62jF6qK2nNfmGDBB0jwU5d7PH urvg==
- In-reply-to: <170414132858.ZM15204@torch.brasslantern.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mail-followup-to: zsh-users@xxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20170414165548.GA13756@teapot.bifb.org> <170414132858.ZM15204@torch.brasslantern.com>
Thanks Bart.
That's cool. However this gives one PS1 prompt as extra output. So I
have to set PS1='' before I call zsh and then set PS1 inside the
payload script.
Demo: Create the setup file
% cat >/tmp/setup <<END
PS1='>>> '
date
date
xxxx () { echo "hello"; }
END
Run zsh - added -f to ignore my start up files
% zsh -fis <<<"source /tmp/setup </dev/tty && exec </dev/tty"
teapot% Fri Apr 14 17:53:13 EDT 2017
Fri Apr 14 17:53:13 EDT 2017
>>> xxxx
hello
>>>
See the extra "teapot% " prompt that sneaks in. Instead run
PS1='' zsh -fis <<<"source /tmp/setup </dev/tty && exec </dev/tty"
and it does the desired thing. Brilliant.
Anthony. :-)
On 14 Apr 2017 at 13:28:58, Bart Schaefer wrote:
> On Apr 14, 12:55pm, Anthony Fletcher wrote:
> }
> } This is an oldie but goodie that I don't have a solution to. How can I
> } invoke a zsh that sources a particular file (not the standard start up
> } files) and then become interactive, preserving functions, etc?
>
> This should do it:
>
> zsh -is <<<"source $aparticularfile </dev/tty && exec </dev/tty"
>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author