From: Anthony Fletcher <anthony@bifb.org>
To: zsh-users@zsh.org
Subject: Re: allow zsh to source a script and then become interactive
Date: Fri, 14 Apr 2017 18:03:42 -0400 [thread overview]
Message-ID: <20170414220341.GA24751@teapot.bifb.org> (raw)
In-Reply-To: <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"
>
next prev parent reply other threads:[~2017-04-14 22:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-14 16:55 Anthony Fletcher
2017-04-14 20:28 ` Bart Schaefer
2017-04-14 22:03 ` Anthony Fletcher [this message]
2017-04-15 1:00 ` Daniel Shahaf
2017-04-15 2:45 ` Bart Schaefer
2017-04-15 15:40 ` Daniel Shahaf
2017-04-15 19:06 ` Anthony Fletcher
2017-04-14 22:41 ` Nikolay Aleksandrovich Pavlov (ZyX)
2017-04-14 23:14 ` Bart Schaefer
2017-04-14 23:39 ` Anthony Fletcher
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=20170414220341.GA24751@teapot.bifb.org \
--to=anthony@bifb.org \
--cc=zsh-users@zsh.org \
/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).