From mboxrd@z Thu Jan 1 00:00:00 1970 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, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 1127 invoked from network); 10 Aug 2021 02:59:21 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 10 Aug 2021 02:59:21 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1628564361; b=p06FOUKgoXdLuc8pwxah9fDpEnpeSneZBpraJc1aoD63L+aff2wahxJ7C4N/daS9Lo3PnOivFI ZqbW91yTFgofwoNtxpdW6M7vF13LRh2laEDYQygiy0IZYjunmG6fhRV7Dx45H/KPr0Y0jRaWpv SIgNofGgV+IakPinMecOJBWqmr4Gb6hz4RWqrMDm21KT6PxGifLj9SBxgKpwsduy+KyRHBX2W1 /33m1Cq7iA+sihOcM/PqI3h88iS+IZn7frSW0BovB+lh4VJjfqBIKj6to0epi6YkqFwRa5Qbc4 5Nt9aNLF74DElket5APwcA9jVIi6EQ4El+tEK8kN9wERvQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (a.mx.sigpipe.cz) smtp.remote-ip=37.221.242.114; dmarc=none header.from=sigpipe.cz; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1628564361; bh=Qikca/yVFJCE9OTO4GAKSqtSLo3bRz9cKAAmS6PiS0A=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:MIME-Version:Message-ID:Subject:To:From:Date: DKIM-Signature; b=hWi6eqalF186drdL9P3ymjklCq9YxcpPHzgnzWCdXspNNa8TTdIOFHdbB8VGVsfss8xpgPNa9J E5jgqCcInWzPntepggVR7hnBC2YruI8WwCldZDMLA2iMVvZ60ZqnEmhjLRmK/SBBdGWw5o/ugA OXfL7nUDREstTNmkRnWxgPaipk7y14VU6j8RXMV5QDjLLZVrdmbZeURqdg776hyjIPOfVncmpR gPjbDikLAt9jG0h55nvQozqO7Wyg1C7UbFt1h1KGxCcA/lcqYTORCLezB71JUeszanqPojE7TA T9IFU6TNgwz9WqmoyCaOhkNlzSI88ngASQxL7Hs52vDPuw==; 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:Content-Type:MIME-Version:Message-ID: Subject:To:From:Date:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=ZEaES5pogHE9C2Fq2rVQQhGvTTObvmFJBckTgKF3+XU=; b=QypgCFim3kbyjSAOiBhGAfILn4 hOY04cB0uBkBU/K+sROIUGaaFdgVMivFsH0ZSJ+dGFbQhv4qe3Y+UsLo/n7vQfl1dZR1O53H4XKsT 0nJnh0hM2mFwuGBNin0VSItbIVO30x64iBCGW88QQpKoyqMwhO3mSeLcqWdUhKAFqkb/9AYDUttbE Es+kV/LzUiaHDAii6yMWXhOzBDL/SmScpW/AarWoGOWV9T9zzDdHbF9kBHXvj2px/nYTVf2qVSjx/ ZtKxlaS/sfrSwL/7uYVa2yGEpHuRAj+vGyC05kfTLUyZgxzdDG5GTC3mqbtLYTiShAbFD/+UtDuNK qehXbHKQ==; Received: from authenticated user by zero.zsh.org with local id 1mDHz6-00050j-9W; Tue, 10 Aug 2021 02:59:20 +0000 Authentication-Results: zsh.org; iprev=pass (a.mx.sigpipe.cz) smtp.remote-ip=37.221.242.114; dmarc=none header.from=sigpipe.cz; arc=none Received: from a.mx.sigpipe.cz ([37.221.242.114]:2931) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1mDHyO-0004Id-FJ; Tue, 10 Aug 2021 02:58:36 +0000 Received: by a.mx.sigpipe.cz (Postfix, from userid 1001) id AB44A15586657A; Tue, 10 Aug 2021 04:58:34 +0200 (CEST) Date: Tue, 10 Aug 2021 04:58:34 +0200 From: Roman Neuhauser To: zsh-users@zsh.org Subject: what does 'interactive' mean? Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Seq: 26886 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: hello, i was looking for a way to start zsh with an ad-hoc initialization file: the shell would would source the file (instead of or after the usual startup files, does not matter right now) and drop into the ZLE. if there's a way i haven't found it, but whatever: i'm here to complain that the manual never defines "interactive shell". (solutions to my original problem are welcome too.) i started from zsh(1): -i Force shell to be interactive. It is still possible to specify a script to execute. noting how it says "execute" as opposed to "read commands from" or "source" i didn't really expect "zsh -i script" to do what i needed but, as a naive user equipped with the common-use understanding of "interactive shell" supported by zsh(1) itself ("Zsh is a UNIX command interpreter (shell) usable as an interactive login shell" -- that's the informal use right there), i definitely expected to get the prompt. well i wouldn't be here if it worked that way... so what *is* an "interactive shell"? here's a few notes about my path through the manual tonight. zshzle(1) and zshoptions(1) use two different vocabularies to describe one thing, that's something to avoid. define your terms and stick to them! DESCRIPTION If the ZLE option is set (which it is by default in interactive shells) and the shell input is attached to the terminal, the user is able to edit command lines. the description of INTERACTIVE in zshoptions(1) contains *no mention of its effects*! INTERACTIVE (-i, ksh: -i) This is an interactive shell. This option is set upon initialisation if the standard input is a tty and commands are being read from standard input. (See the discussion of SHIN_STDIN.) This heuristic may be overridden by specifying a state for this option on the command line. The value of this option can only be changed via flags supplied at invocation of the shell. It cannot be changed once zsh is running. SHIN_STDIN (-s, ksh: -s) Commands are being read from the standard input. Commands are read from standard input if no command is specified with -c and no file of commands is specified. If SHIN_STDIN is set [...] ZLE (-Z) Use the zsh line editor. Set by default in interactive shells connected to a terminal. as you can see in the snippets below, -i implies -Z *even when stdin is /dev/null!* which is not what the docs seem to say, and the independence of ZLE option from ZLE repl is far from obvious. % :>|s % zsh -fi s; echo NOPE NOPE % cat >|s <<\EOF > [[ -t 0 ]] && echo input is from terminal > set -o > >(grep -w -e zle) > EOF % zsh -fi s input is from terminal zle on % zsh -fi s |s <<\EOF > [[ -t 0 ]] && echo input is from terminal > set -o > >(grep -w -e interactive -e shinstdin -e zle) > EOF % zsh -fi s input is from terminal interactive on shinstdin off zle on -- roman