From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16247 invoked by alias); 7 Feb 2014 00:31:22 -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: 18408 Received: (qmail 16195 invoked from network); 7 Feb 2014 00:31:18 -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=0XNbi9ts7GRXajKgFSt2NBTQfwvz7dmX/jvPyqYcSME=; b=hKCXVzEV4h92xYC1uN8wH58iNMoen90fmk134sB6MHRgEke4TqKwXg+uoVEkTCmqRQ 4VheTHNemAiHy0E4WBc6t6Rrt8HtPMrBWJjo2E8z6ZG3j+t5Wvhl2rtepo8DcI5x8/6u MbCJ7rFixhlu5vQwSEPeNnzGYdn9Y1D150UTsOTmbw6EB/M3+TIw07214GlkMhdnlmCw pd/BreJ8sv5Oi6Y5dfJt+Rt+6t3syXfBhRZHmjf2/M/4XRfFXjAP++VwBsSa0+UYf91w RUaCked3gvLlM9jp6oKjpw0neqYOTBr1y4lPGTlkubHe6JntrnFAWwW6ajnQeVIDXwKz Ei8w== X-Gm-Message-State: ALoCoQnLtOyYUqlg+yzi3dEyPL9e6noV3arNqU3QnxqtMtvU5UMVk22vLxnKa0FAz/Xs19gBzsVJ MIME-Version: 1.0 X-Received: by 10.66.189.100 with SMTP id gh4mr4000712pac.25.1391733073266; Thu, 06 Feb 2014 16:31:13 -0800 (PST) In-Reply-To: References: Date: Thu, 6 Feb 2014 16:31:13 -0800 Message-ID: Subject: Re: Executing command on reattaching to screen session From: Kurtis Rader To: Thorsten Kampe Cc: Zsh Users Content-Type: multipart/alternative; boundary=047d7bf0e06474637304f1c61b68 --047d7bf0e06474637304f1c61b68 Content-Type: text/plain; charset=UTF-8 It's pretty easy with tmux (via "tmux send-keys") but you need to consider unwanted side-effects if the session isn't at a shell prompt awaiting input. What happens if, say, a command like vim is the foreground task when you try to execute that command? You're just asking for trouble trying to do it that way. The only time I use that capability is when I know I'm establishing a new session and want to do some custom initialization (e.g., cd'ing to a particular directory and launching my editor). On Thu, Feb 6, 2014 at 10:27 AM, Thorsten Kampe wrote: > Hi, > > 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". > > Thorsten > > -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank --047d7bf0e06474637304f1c61b68--