From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3626 invoked by alias); 24 Jan 2014 06:12:38 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 18354 Received: (qmail 12396 invoked from network); 24 Jan 2014 06:12:32 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,HTML_MESSAGE, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=JonQiQ+bJiuSfx/NjoEW7dLFPS2Uy/yiICn0FJLGJs8=; b=BWoiEQvyulOMMdWOI7PKQ7O59SNbHetB8c5jc2sNPFSO96Q2svkS0E0vPClsxQU9yV C/yK9noOUVhZWFqn5rFPTzuC8bjxoUhOyBvQzK9bg5VrDnGYHc2eh2p2V4tv4CMjmQQp +KyapPC7sOTWZp6uJJvdTM1Ya8OdNLL178SgzMdECPMPgp1vrgaLLuTgENUZ48MrXIjD 4KwSohaL7zazwYRGiwfIn1Q0t1lq6g6EdeDikJdDw/VRFafjMt9UwICTaFzcWnD5ILKQ WocwEkFcOPI+8pVMxDaWwZJiAbX/IWIkACaLf7/shoRUVLtRikuCbIOp6JQg4Qg2R8Gf ZENQ== X-Gm-Message-State: ALoCoQnkbLEP8k69tNAvifnTBe0aJji3jBn4rSFlFb50E7JfOZcst9movjrvc+yH82tIdFt9sJ25 MIME-Version: 1.0 X-Received: by 10.66.217.133 with SMTP id oy5mr12801343pac.46.1390543949759; Thu, 23 Jan 2014 22:12:29 -0800 (PST) In-Reply-To: References: Date: Thu, 23 Jan 2014 22:12:29 -0800 Message-ID: Subject: Re: how can I invoke zsh via screen when logged in via ssh? From: Kurtis Rader To: TJ Luoma Cc: Zsh-Users List Content-Type: multipart/alternative; boundary=047d7b5da8912ba6ff04f0b13ea6 --047d7b5da8912ba6ff04f0b13ea6 Content-Type: text/plain; charset=UTF-8 I strongly recommend using tmux rather than screen. It has a much saner configuration language and is more powerful. It also correctly handles terminals which support 256 colors. I wrote a pair of scripts for work that wraps around ssh and tmux (and iTerm2 for Mac OS X). This allows me to type work attach to create iTerm2 windows appropriately sized and positioned and attach each to its corresponding tmux session on the remote host. If the tmux session isn't already running one is created. It also takes care of ensuring the DISPLAY environment variable is set appropriately to allow X11 based apps to display on my local system. It also supports a bunch of other commands, For example, "work list" to enumerate existing tmux sessions. Or "work ssh" to get a raw ssh session. If there's interest I can work on removing my employer specific bits (which deal with managing a VPN tunnel). On Wed, Jan 22, 2014 at 11:54 AM, TJ Luoma wrote: > I use zsh as my login shell for several accounts I connect to via ssh. > > > My connection to these accounts is often fragile, either because they > were initiated on an iOS device or behind a satellite internet > connection. > > > I had a thought today that perhaps one answer would be to use > 'screen(1)' as my login shell for those accounts, but then I realized > that I didn't want that to be the shell I use for local logins, just > for SSH logins. > > > I wondered if anyone had already done this, so I didn't have to > re-invent the wheel, or might have some experience with potential > problems that I might run into when doing this. > > > 1) Would 'zsh' function normally when in screen(1) ? > > > 2) I've already noticed that emacs keys don't seem to work right, i.e. > control+a does not jump to the beginning of the line, although > control+e jumps to the end of the line. Should I make some adjustment > to `bindkeys` or anything else? > > > 3) What's the 'best' way to invoke screen(1) from .zshenv ? I already have > this: > > > PPID_NAME=$(command ps -o 'command=' -cp ${PPID} 2>/dev/null ) > > > case "${PPID_NAME}" in > > sshd) > > SSH=yes > > ;; > > > launchd) > > LAUNCHD=yes > > ;; > > > esac > > > So I was going to change it to: > > > > PPID_NAME=$(command ps -o 'command=' -cp ${PPID} 2>/dev/null ) > > > case "${PPID_NAME}" in > > sshd) > > exec =screen -r || exec =screen > > ;; > > > launchd) > > LAUNCHD=yes > > ;; > > > esac > > > which would, I believe, resume an existing `screen` session if one > existed, but would otherwise just launch `screen` anew. > > > Is there a better way? > > > Thanks in advance, > > > TjL > > > > > ps - bonus question: anyone know how to tell screen(1) to _not_ show > its welcome message every time it launches? > -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank --047d7b5da8912ba6ff04f0b13ea6--