From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from minnie.tuhs.org (minnie.tuhs.org [45.79.103.53]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 55ec2db0 for ; Mon, 20 Jan 2020 08:47:01 +0000 (UTC) Received: by minnie.tuhs.org (Postfix, from userid 112) id 4BE309C14F; Mon, 20 Jan 2020 18:47:00 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id 110729C0FD; Mon, 20 Jan 2020 18:46:19 +1000 (AEST) Received: by minnie.tuhs.org (Postfix, from userid 112) id 00E219C0FD; Mon, 20 Jan 2020 18:46:16 +1000 (AEST) X-Greylist: delayed 401 seconds by postgrey-1.36 at minnie.tuhs.org; Mon, 20 Jan 2020 18:46:11 AEST Received: from wopr.sciops.net (wopr.sciops.net [216.126.196.60]) by minnie.tuhs.org (Postfix) with ESMTPS id 93F529BFE6 for ; Mon, 20 Jan 2020 18:46:11 +1000 (AEST) Received: (qmail 80745 invoked by uid 1001); 20 Jan 2020 00:39:28 -0800 Date: Mon, 20 Jan 2020 00:39:28 -0800 From: Kurt H Maier To: markus schnalke Message-ID: <20200120083928.GA68939@wopr> Mail-Followup-To: markus schnalke , tuhs@minnie.tuhs.org References: <1itSE0-5Td-00@marmaro.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1itSE0-5Td-00@marmaro.de> Subject: Re: [TUHS] Shell Level... X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: tuhs@minnie.tuhs.org Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" On Mon, Jan 20, 2020 at 09:15:56AM +0100, markus schnalke wrote: > Hoi. > > [2020-01-19 14:22] Grant Taylor via TUHS > > > > Have you ever used shell level, $SHLVL, in your weekly ~> daily use of Unix? > > What's the use of it? I have seen it used -- and I do not use it this way myself -- to construct a sort of work batch, where a control script launches many instances of itself, which then inspect $SHLVL to determine that they are subordinates, and process elements of a central work queue. The parent instance would monitor the number of copies of the script in use and launch new subordinates in the case some of them exited for whatever reason. The whole thing felt alien, but it seemed to work. The other, more common use I've seen is to e.g. clear the terminal window on logout (e.g. in .bash_logout when SHLVL=1) but not when exiting any nested shell. It's not POSIX, so I've never relied on it. khm