From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id 13D23212EB for ; Mon, 11 Nov 2024 22:36:08 +0100 (CET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1731360968; b=oUUfelGzR0LPI2qDLruCGRMGeZAztHXFHnpUX392xdOH0O/nuo0WGLDJKF8y0uYE+VXEE8kGR4 aG4yJgaFmsps4gDWPv0rNEKDji9fN/TzDwpjU+B5+5m+nnqWvmTwCmVdoRg98jB9MwpR1aj1L5 BkwZqoboA/m/pFXgeSQbHXCNu6FKcPS3eyHkEXuPoUgmg5vwYTBgtTYLA/KXNoAsCLcH+UAS9C Y6vS2lBd9jNqVbfRGC6P8uHjaODTR/kq/SEFl2/POUY03iZ6dmldvMyAao3FzQ5A3ju//VXdDJ /4J8FGVg9PQtBmx8m0OxxSK2Br+RTz8b7ftkke4ql8LBoA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mout-p-103.mailbox.org) smtp.remote-ip=80.241.56.161; dkim=pass header.d=mailbox.org header.s=mail20150812 header.a=rsa-sha256; dmarc=pass header.from=mailbox.org; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1731360968; bh=I/SB+5dDv2WDSq9CjZ0IznnSeapgTS52//S01/BEkpQ=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Transfer-Encoding:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:DKIM-Signature: DKIM-Signature; b=i35Zp3oVcdUFoaxGUNHbfBGry5Ko7fZn8LWo3SA6U0IkQK+zspP/LHif67gLpeeiumVQiIFqz7 5oSBxkul/RSyB0FFR/zdvzOtGfKYRO2nEWZMZdKSgEbTJOUyJORvwK4DH8x47p4sufYEqw+PAM ntalY37AXsYkvI5dhtNu2KdPsdi7tM29ZWVUImIp5E6GjhCuqHLixrgpRhHSr0MjhYgj8NZ4pm 2vXthgGrcy+UDwiexNHluPRTYybdl1elO/u+YGpqQ8QeJqb2HjkskeTUoNYX77yDgIPlZBpz/e /SZb89D5fCNb1aW79nrI0AN+xL9Z3sAzZiG7/3/gtGz8Zg==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID; bh=CdYI9VJX4CYxW0EoNnFMBEDFnm0pFMkBu5IV5w3I6j8=; b=WeOSwaecXD/Ekt5po21V47/tUW rTEkQiw7cY9TjXX+qThtwrLEk1Kaxkyt8Ej5ZEQdTK+gtupnszl5H+f5EnZ3824aMCoIiCGNRJF5g EwE7mt8URodsZqppO+YWRPuWNQqOwWkEFMkLPxN+QzMxQnb6SNVT5c2ifvIVKNjKrB5eWAYe44ys4 cbQlFGGyDhQj59OvVQcbbJWlyXAgqHbjVODxu3lqs5LtmgE2yj/1u0lMTXXTGYnaB7FyPMJaoujVz neL5rR2+YN/ptkcNaZX7UQmZPfQi/Q/opLzthYFuLqO/VjN4Q8HySKje+39i42MfZQPbtO43S715v aeE28YQQ==; Received: by zero.zsh.org with local id 1tAc4t-000Mm4-FN; Mon, 11 Nov 2024 21:36:07 +0000 Authentication-Results: zsh.org; iprev=pass (mout-p-103.mailbox.org) smtp.remote-ip=80.241.56.161; dkim=pass header.d=mailbox.org header.s=mail20150812 header.a=rsa-sha256; dmarc=pass header.from=mailbox.org; arc=none Received: from mout-p-103.mailbox.org ([80.241.56.161]:59384) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1tAc3x-000Lw8-EL; Mon, 11 Nov 2024 21:35:10 +0000 Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-103.mailbox.org (Postfix) with ESMTPS id 4XnNB12PrBz9spX; Mon, 11 Nov 2024 22:35:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1731360905; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CdYI9VJX4CYxW0EoNnFMBEDFnm0pFMkBu5IV5w3I6j8=; b=a2HBhbCV21JWXwLc3MXTB5MECAO+wsucpCPVzcVqLqoLK+bod1NwiU+MOCW+8j8Yx2wnPr w5Oo7Y7VJaAUaDwC8pec+y76Wa5IXn8IZEa+/CjdkJTOJL3T5SnvY2VkGmvAYcfDjpoM38 SxfgvW0837sVX3lC/jjv4zsl/wqS941YK4oqwFpMlJqJR367EGC8SYOoGukfsVnR9ZXfIX D/tcDyT/U4NtsfQ0+NeV8bsGJQx3q2FdSQsSy1VLOGuwkfCwEc+xO0GXdYQFurI0KCSk7w MFPw9kvSa5sPp6ekKuj29Z7uojfn8PGNlQyk48PuQQrJY6v5F/UP/CDQtP7Cbg== Date: Mon, 11 Nov 2024 22:35:03 +0100 From: Sebastian Stark To: Ray Andrews Cc: Zsh Users Subject: Re: monitor screen output Message-ID: Mail-Followup-To: Ray Andrews , Zsh Users References: <4d7d4279-c30e-4c2d-9291-4ca985780673@eastlink.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4d7d4279-c30e-4c2d-9291-4ca985780673@eastlink.ca> X-MBO-RS-ID: e2b92e46b6b33b8b3e9 X-MBO-RS-META: 1maqd5sm7jz4zqzaqdoc8gbzmuqb4sai X-Seq: 30104 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: Am Montag, den 11. November 2024 um 17:45 schrieb Ray Andrews: >All: > >Can zsh monitor screen output in a backgroundy sort of way?  Say I >have several programs that might at some time or other output some >message, can zsh keep an eye on the screen any time it is written to >and detect that message and act upon it? If you want it to be done natively in zsh you could probably use the zpty module (see zshmodules(1)): Load the module: $ zmodload zsh/zpty Start top in the background. That would be your program to monitor. It will get the handle 'top'. You may start several programs with different handles: $ zpty top top Read from the pseudo terminal into "var" until pattern "*mutt*" was found: $ zpty -r top var "*neomutt*" Now Start neomutt in another shell. Above command should return after a couple seconds and $var should contain the top output including the matched text. Cancel the background process if you are done: $ zpty -d top Expect is probably the saner option to use. Sebastian