Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: A few lines in .zshenv (re ssh-agent) disable scp and rsync?
- X-seq: zsh-users 16105
- From: Vincent Lefevre <vincent@xxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: A few lines in .zshenv (re ssh-agent) disable scp and rsync?
- Date: Mon, 27 Jun 2011 14:51:00 +0200
- In-reply-to: <alpine.LNX.2.01.1106270314160.21636@hp.internal>
- 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: <20110627062740.GA28993@panix.com> <alpine.LNX.2.01.1106270314160.21636@hp.internal>
On 2011-06-27 03:36:23 -0400, Benjamin R. Haskell wrote:
> You shouldn't put anything that echoes output to the terminal in a login
> profile. That should be saved for interactive startup scripts.
>
> In Zsh's case, that means you can solve this by simply moving those lines
> from .zshenv (which gets run for all shells, including those which don't
> accept input interactively) to .zshrc (which is only run for interactive
> shells).
Or this can be tested. For instance, I have:
[[ -o interactive ]] && echo 'zshenv...'
> So, you could also solve this by conditioning all of the ssh-agent actions
> on whether a terminal is connected:
>
> # if stdin is a terminal (unnecessary in .zshrc)
> if [[ -t 0 ]] ; then
> # kill the ssh-agent on exit
> trap '[[ -n "$SSH_AGENT_PID" ]] && eval `ssh-agent -k`' 0
> # start the ssh-agent if not already started
> [[ -z "$SSH_AGENT_PID" ]] && eval `ssh-agent`
> # add identities to the agent
> ssh-add
> fi
It depends whether the user wants this to be executed with:
ssh -t <host> <command>
BTW, I think that on-demand ssh-add is better (i.e. running it just
before the ssh/scp/...).
--
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author