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,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 14344 invoked from network); 16 Sep 2022 15:20:34 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 16 Sep 2022 15:20:34 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1663341634; b=WUHzX0k6EFigsEkAIornjpUtgdDvjMJYSwOLIFqAYLm3utrGqX3oBvKYGS/2RRMrBG4Ix6bnfd Q6AyjJ5vdI+G0nj+mvC2r1vUNrAgiZDJ8hwdO659NQ7XOYG1jKlmWPFWgqfGVLmE+X1nz1IcHp vAB+2wrdvHuuCCZruh3dEk4dG7gLckROtVh/q4GqXxPO98PpigY/H2q8bEpMWJYPmnUPdp0Odp yAg3KiyV2gCsi80u9It3J3jb0bLgM7ine21cRc+Fl8RpLSEG8hghAJb4vZD4PQuZS1h5DGeFKf EYQfpuukYkHb9acVsaYiZSbbVH5EJQUP2XxqX4Oz2fgIqw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mta02.eastlink.ca) smtp.remote-ip=24.224.136.13; dmarc=none header.from=eastlink.ca; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1663341634; bh=VM1RMugNjAjGpd0ird8bO3LROrhwMYyJT03iIjChUAo=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Subject:From:To: MIME-Version:Date:Message-ID:DKIM-Signature; b=sAGQ6pwQmaGIHFVUC5ajfRJ5Or3ZcSy6X1+giKvsQlhZ2brE3xI5M1C8K1UpAqF8GUI10Fi6i3 dAaa0hQNJojnIQ3XoBNWgBmLptljVXuHpJL0mBYgdNVFu2D9T0QKkZhSfwewRDV51zU8AvDHFx pXbqqoFljGubumcbjDRNnX2/rGJ3svWdolmhAcKG5CPPUcew2CPoLK4NlLG291D8y14xbRaiQJ SXci+mRP/vd7WiBsNxXEhT9V/YDHqjYL1SgnULNnFsBa+yhftt7F4yMJL1ZW0ANuIbOBlY/6Gm 9VDCYUSapsGm5Hz+puwIBD7/dXwBtnyQZbbjJqPtv3PwYQ==; 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-transfer-encoding: Content-type:Subject:From:To:MIME-version:Date:Message-id:Reply-To:Cc: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References; bh=UPLWMtnQ81eIt6JlfgXOrE/DQrNsGGMVIyDBG00VPiE=; b=CkMhMizx242LB0PDGR58tikRkt u+Rkp+rXnbHrgYLG32e0qyeFbEhlTmGD1nScugF7dDZlKLLdMXSADlgnIvsDZBXulhk/KzqxiDyZR TQh7/c6YUbERMkz9zjyXJgNi9lLW3OffqAUl9HJk4LRcaH5QhUV+WtwE0N2VDfWUQhIOqLV7YJE6u GYFzZHgAm4MWyy+soi8RNsWWVZpupNEC2P1EMP71Q1re+yyPUZ0Wre2kZByV1/uH5zFioSVjP4VVQ aORbzETp2n1KFzXtCpmjVUhuRLGbEy53I+Hw+mw2OzJPKw2kJ+pKx24yB3iabVRt7a4DcJP3o8jNu uP8z7yqQ==; Received: from authenticated user by zero.zsh.org with local id 1oZD8q-000NDP-JL; Fri, 16 Sep 2022 15:20:32 +0000 Authentication-Results: zsh.org; iprev=pass (mta02.eastlink.ca) smtp.remote-ip=24.224.136.13; dmarc=none header.from=eastlink.ca; arc=none Received: from mta02.eastlink.ca ([24.224.136.13]:47514) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) id 1oZD7S-000MWb-Sf; Fri, 16 Sep 2022 15:19:07 +0000 Received: from csp01.eastlink.ca ([71.7.199.166]) by mta02.eastlink.ca (Oracle Communications Messaging Server 8.0.2.2.20180531 64bit (built May 31 2018)) with ESMTPS id <0RIB00ND16EGYCJ1@mta02.eastlink.ca> for zsh-users@zsh.org; Fri, 16 Sep 2022 12:19:05 -0300 (ADT) Received: from [192.168.0.3] ([24.207.18.108]) by Eastlink with ESMTP id ZD7QoAURlFC8dZD7RofVJW; Fri, 16 Sep 2022 12:19:05 -0300 X-Authority-Analysis: v=2.4 cv=HaHR8gI8 c=1 sm=1 tr=0 ts=632493e9 a=xN66ZtSbq5jdJYpBp7G/jQ==:117 a=xN66ZtSbq5jdJYpBp7G/jQ==:17 a=IkcTkHD0fZMA:10 a=MiS198v3cbohI9N40T0A:9 a=QEXdDO2ut3YA:10 X-Vade-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfedvtddgledtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecugfetuffvnffkpffmpdfqfgfvnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefkffggfgfvhffutgfgsehtkeertddtfeejnecuhfhrohhmpeftrgihucetnhgurhgvfihsuceorhgrhigrnhgurhgvfihssegvrghsthhlihhnkhdrtggrqeenucggtffrrghtthgvrhhnpeevhedugeetieevveeiueethfffleehkeeugeehtdehgfetjeevhffgkefhieegffenucfkphepvdegrddvtdejrddukedruddtkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvgedrvddtjedrudekrddutdekpdhhvghloheplgduledvrdduieekrddtrdefngdpmhgrihhlfhhrohhmpehrrgihrghnughrvgifshesvggrshhtlhhinhhkrdgtrgdpnhgspghrtghpthhtohepuddprhgtphhtthhopeiishhhqdhushgvrhhsseiishhhrdhorhhgpdhgvghtqdgkihhprfgrshhsfigupehtrhhuvg X-Vade-Score: -100 X-Vade-State: 0 X-EL-IP-NOAUTH: 24.207.18.108 Message-id: <22a10f61-5f82-9797-4bc9-9082f9371dc7@eastlink.ca> Date: Fri, 16 Sep 2022 08:19:04 -0700 MIME-version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Content-language: en-US To: Zsh Users From: Ray Andrews Subject: local but persistent integer? Content-type: text/plain; charset=UTF-8; format=flowed Content-transfer-encoding: 8bit X-Seq: 28098 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: This works in my function:     if [ "$1" = "start" ]; then         integer -x start="$(( $(date +%s%N)/1000000 ))"         return     fi     if [ "$1" = "stop" ]; then         start=0         return     fi     [[ $start == '0' ]] && echo "Timer not properly started" && return     ... code ... I need 'start' to persist between function calls which it does but it would be nice if it could be local as well since it has no use outside this function.  Also, it would be more hygienic to kill the variable entirely in case of 'stop' rather than set it to zero.  I tried 'unset' but it didn't seem to work.  This will be doable of course.  Very minor issues but I'd like to be able to do it properly.