From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22974 invoked by alias); 7 Feb 2014 01:06:32 -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: 18411 Received: (qmail 11048 invoked from network); 7 Feb 2014 01:06:17 -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,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <21236.11792.398711.734931@ixian.com> Date: Thu, 6 Feb 2014 16:51:28 -0800 To: zsh-users@zsh.org Cc: Thorsten Kampe Subject: Re: Executing command on reattaching to screen session In-Reply-To: References: X-Mailer: VM 7.19 under Emacs 23.4.1 From: Eric De Mund Reply-To: Eric De Mund X-Sonic-ID: C;EDBk+pGP4xGKb6VxIE/FGg== M;uBHvCJKP4xGKb6VxIE/FGg== Thorsten, ] tough question: can I automatically execute a command on reattaching ] a detached byobu (screen or tmux) session? ] ] Every time I login, /etc/motd is displayed. Since I hardly ever log ] out and in, I'd like to have the same functionality when reattaching ] to my detached session. This could be a simple cat /etc/motd kind of ] "autostart". Perhaps screen(1)'s '-X' flag may get you close to what you're looking for. Note that the word "command" in the description, there, refers to valid screen(1) commands, not shell commands: SCREEN(1) SCREEN(1) ... COMMAND-LINE OPTIONS ... -X Send the specified command to a running screen session. You can use the -d or -r option to tell screen to look only for attached or detached screen sessions. Note that this command doesn't work if the session is password protected. Regards, Eric -- Eric De Mund ead@ixian.com