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.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 8844 invoked from network); 20 Oct 2022 18:45:28 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 20 Oct 2022 18:45:28 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1666291528; b=sHIJ2I28LWWiEzosVAs4dHBsLsxQV3HjJCJdli0aWLocdPv9gB4yzndkvJsi8/t6RzJG1RvxP9 NqRpuO7d3T80yZC2BL25MZo1mjWBSRs0cuRxhyMyhUEm/jSD1HpZE3QCaL/O9RhRdE93zp1mnm cnV/oC9SBNZr0sy5CuTNV79vjEpF7oL7/wZ7wTwy2nWe+f9zlF1rdAqopWFQMOPBivW/GdUX7b ZHAPETThuJapNMPPeihYg2I0EsW4OsKNv3GivYzmvobTNA92aPZKW1VdWV3dgQjVhn+UdUiHcl sArhexzx8sRITuD9uWJHTV/K78vYUubuLvpXX4+3rdxRSw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-yb1-f176.google.com) smtp.remote-ip=209.85.219.176; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1666291528; bh=JtL9/nO4uSHCn+e2cqOViId9rVkJhlCV5EZGTYvhlLM=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=hmGAlUU/akHo1Ik39AvEWZ6u/raRazIYLftZKsuEmzRclSxmnEVxeknIySe8Wzn2LmcOIyqK2q 2TAKhj3vYnhMS9Wt5igr7pm9a7p6QIsomVI40bvuZbsdMAvRRaF0hiXFzXX8lVvYMMOd6jiktB wIcoAALhYbDi7AX9BkVX48OJ5841JfAAxXa4vHR3PiXVvpW0MIV1Ck40ccgYlzOuQnAoSrtXct z4eGMm9TXNOdV2ONpz2pBghv7hV8ccjmx0JTyRIHKH07muZqOhiCH18UamMiFkv7AQ0Y+sBx0Y Xefig6h1RI1l8duzAhqRKrUHmCG/T/j8IcOh7rMM+jDs5g==; 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:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=ebzNQA2Kt1h7JZ5k36wSsXUztnsy/D70btDXSYXw6CE=; b=Fcq2YS6tVxEFtFKaUNxyA+4kIw MKt3JQJS/fNF5iAWAzO0MiovhDJGFM4Mn8AiccAzAxz/SDmi9dUHlZbu36+xYnUuNVQYyC51bPHXN QRMwc5E21ch+aDPurbqwdpa6OZdW4hs2XSy2NHRPBPrSXn9BUV3+rQRunSXECbUjV0ZkNZp1hTTgs FgLMSTFNlFzU+MQjEF2y7JuZ0iEklX/TrLKLs9hWAe0TZsrpgZcYokmk0W5TW4T/b/cZ7oaxyMgf6 VpmGE2/uW8MMMPQbit08GJnuvoccE36KZDTYBbiAKfPq9P5UxhrKEfv/eYo8ULcuprzMcsxKigN3i teiUeHAw==; Received: by zero.zsh.org with local id 1olaXn-000CwP-Ub; Thu, 20 Oct 2022 18:45:27 +0000 Authentication-Results: zsh.org; iprev=pass (mail-yb1-f176.google.com) smtp.remote-ip=209.85.219.176; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-yb1-f176.google.com ([209.85.219.176]:43619) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1olaXC-000CFG-4J; Thu, 20 Oct 2022 18:44:51 +0000 Received: by mail-yb1-f176.google.com with SMTP id n130so617433yba.10 for ; Thu, 20 Oct 2022 11:44:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=ebzNQA2Kt1h7JZ5k36wSsXUztnsy/D70btDXSYXw6CE=; b=ZVQzNwAxXe7jyKitCsr58Sr/C42HoXsDk3IbUhtaH/WQkzmNCyt1mMgcyXYl7lwSaw OPdBMDuTMcLhOHq2gmhvIHxl/zdbzPvfze+Gj4+i1GnVpC4N02kOuSfsmvWDp5gUbejM sI/Jj/MCBJHGi+Z4GJezy/Huoqit4AOnoyM0GEmQmZqw7Fh+BPmrceR5X3zVN0+/SQmW N5dcX1tklOOcM51LomO373mtlTxeGtS98wOeOE+Hb7+YqXBAlr0kJNXaTDBLn6cWX2dJ 9g0UZ7LmmreMmP0Pym43EyJysOk8YgY+olisoMB4RkqmV476ENlew8CeFslf02XgJx1l HcoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ebzNQA2Kt1h7JZ5k36wSsXUztnsy/D70btDXSYXw6CE=; b=dK/SeU50n7E/Stdml5NESsaloHB6lAQ2qQj41Yquk1DedrHCKcK/zoWYo/6WulWU7x g+k6k79QozRJATpoUQ3+FitMnGB3LJZLs4RncF9bgJkyMeskgNpe4/ulCNvSXNDGFnUQ JU3NjsYiO4vnpScWlp98G1XWL8GozLdHsDoE8Gelztr6FLqDqI94Zi+RZXoPfTEAjKI/ DyQko6S2t7Hq7pDyCILh9qMw5N3NQ8S5CfPh28AY1+0G/Qr4cWy88fp0L3Mz4hwQHeZs F7ckASkLRIraRqn5XjRUbBrBSXyj7EPpiuz5QMv6HeZzJprp5PbFmpOHQZPrGo6SlLU2 71ow== X-Gm-Message-State: ACrzQf1RZl1/4+nC0t+Zu+WNTG9EEJslaAMafyaMbPopj+ynNQ3vMb9+ uD7lhES6afwFoiwuvBjVBBBrG+dT7KrtCCMapDFRIBM8 X-Google-Smtp-Source: AMsMyM7ajRv3tp2+Ho5gfSu/GfzfYgb3r2oXuKedn4Ex56cacoAfXkQz4go2pR0OR0Xzi1dK8TrPwfMnf98bQxPs95A= X-Received: by 2002:a5b:a0c:0:b0:6b4:446d:2f9 with SMTP id k12-20020a5b0a0c000000b006b4446d02f9mr13584831ybq.138.1666291488721; Thu, 20 Oct 2022 11:44:48 -0700 (PDT) MIME-Version: 1.0 References: <5f18c162-e111-21ba-3ebe-ece09a477ecd@eastlink.ca> In-Reply-To: From: Roman Perepelitsa Date: Thu, 20 Oct 2022 20:44:37 +0200 Message-ID: Subject: Re: var=$( typeset "$1" ) ... not within a function. To: Ray Andrews Cc: zsh-users@zsh.org Content-Type: text/plain; charset="UTF-8" X-Seq: 28239 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: On Thu, Oct 20, 2022 at 8:39 PM Ray Andrews wrote: > > On 2022-10-20 10:54, Roman Perepelitsa wrote: > > The function is a red herring. If you run `unsetopt typeset_silent` in > > the function or before invoking it, you'll see the same behavior as > > you see in the script. If you read the description of this option, > > you'll immediately see that everything works as expected. This option > > controls `typeset` in exactly the way you are observing. > > But wouldn't my shell settings be inherited by the function? It may be > all as wanted, but it seems anomalous. Why this special handling for > typeset? I can see that if you are setting or changing something, then > the effect within a function will be different so various protections > might be in order, but the simple display of an environment variable ... > it seems strange. There is no special handling of typeset within functions. `typeset USER` behaves differently depending on whether typeset_silent is set or not. You tested `typeset USER` in an environment where this option is set and then in another environment where it's unset, and got different results. This is expected. If you want `typeset USER` to print, make sure to unset typeset_silent beforehand. However, what you are doing is so bizarre that you should probably rewrite that code. I would offer an alternative but I have no guess as to what you might be trying to achieve. Roman.