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,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 9073 invoked from network); 1 Sep 2021 03:20:26 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 1 Sep 2021 03:20:26 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1630466426; b=JH+TYrgt17HOrUi6a5+Ud6QUQjhEZQ5hyDICiOs/0aQZ4AloCBZRcrVZtFAiy/HYZm95hNqIJN b/wzAhaT23KjuoDDxgs3CO1Eltx8fN966+fSPFvOZoRQh/r3NpGK0muRiRfksPjNJDTY+ttiYJ DeZrU/c/327cFLF11qaV0i6xzGHe1ERAowxWb4N98uL6pRT72vbWyevSes/Ozk00EP9W2kKodY 1S8JyvSSzq26CSezdVTXFh7FqSvEIrzYou1NOHcztf+BnSpEdDFapcQpAbhvtJWZz+mzxkGH8x T0AerHKBRyelf9hGmHMZM3Q2oSAwW3EWFTbYIjvG1nHR7g==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (email.dondley.com) smtp.remote-ip=34.203.132.18; dkim=pass header.d=dondley.com header.s=default header.a=rsa-sha256; dmarc=pass header.from=dondley.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1630466426; bh=0ogLFLiEjNCYH76ZxuMxaxdB2Kl6YpFb+rB8vp0MwOo=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Message-ID:References: In-Reply-To:Subject:Cc:To:From:Date:MIME-Version:DKIM-Signature: DKIM-Signature; b=gfxkEZi/gg7CIZHbGF9a99PhwjBaOFNiOyRTwvBi0MT51QzPib1d7KOSdHk73LrdkwPLcZAI9G VW65SX5fzXE/ps+A8QZf7egS6iOjgMEpTBTYoxzGuQYBQPrZkL3eRaj4SHBX8apxRmPTUG1ZJt nkJME3HXZ0uQATjxu2FPZeaHifBC7APqsgAzTVVlZpE33yBJmg1TtsvfxNwjavquqD4/LR20Eh U4opAjwf6KdvBj8W+CqPa9TfTc0C8FB6nI1P0/64dqUemym7+KAS4v4IZTXPkLKRcgCjil00AR zZ8/BFuBJ4BAj9Zun8+YZVSp+WRbSLGcvU3CkTIlYoSq9w==; 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:Message-ID:References:In-Reply-To:Subject:Cc:To:From:Date: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=uCOc2nYDRkj6Av9vB39nprIk4aqNkdR6RlXcuBBDpSk=; b=lTaxfVGIBgshRSVfUmaweGXL/B ZHm53uQ4xkUiert7+v6sDoxfOQKxLx1qaBWTVZteLo8+bSaQwQS8UNzdXvkUJ7Dqi/QaSuT6hks51 zcMlts8hNZOeRJWJ8D7pGoI6TTrBpc/AJAq7yYPEtT/xx87IZYUwgvh4jQiIljBDEx7bxc9TDy3rA 7fKAApnK2+iUL4+HUDXu+5b/VeWJaLgvj7Rkjl7RYA2MuYwazlvjzPW4S4yvI6QbWgz7mMKHpiFn2 e2M9+w1mkpfQyoWokLB49u7+bPP62G5dUf8/EBAMQbQcoML5l0Svp5xynoctTT0sHGOLoc6lxoLw6 WksR5SKQ==; Received: from authenticated user by zero.zsh.org with local id 1mLGnZ-00038R-DZ; Wed, 01 Sep 2021 03:20:25 +0000 Authentication-Results: zsh.org; iprev=pass (email.dondley.com) smtp.remote-ip=34.203.132.18; dkim=pass header.d=dondley.com header.s=default header.a=rsa-sha256; dmarc=pass header.from=dondley.com; arc=none Received: from email.dondley.com ([34.203.132.18]:52568) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1mLGn4-0002PT-4N; Wed, 01 Sep 2021 03:19:55 +0000 Received: from email.dondley.com (email.dondley.com [34.203.132.18]) by email.dondley.com (Postfix) with ESMTPSA id D9C35208D1; Tue, 31 Aug 2021 23:19:51 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=dondley.com; s=default; t=1630466391; bh=0ogLFLiEjNCYH76ZxuMxaxdB2Kl6YpFb+rB8vp0MwOo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=hci8LLhBg4w/7aIOUwFH92dJlKUBdEs3w6BhuLATpxkKuoNd1kyXqOVy96ZffXpOJ 3AfFiGVb7tt7zatgE2lKtzt7hXbIVLGW+kehAuK0FTGHDnP+nEx2t4Pk/wToJoU+Yx SEiXSGSvrlPkp5JshFqUIlq9bw2X/l/3wwvV15vrs2CwY3zjpCB7+qX86hhQJ5/8q4 7ohRuJFvyFlDXd6JFkQyF/Mj8UdbMaY5Gby93/XRdoLhb6Yy2K1Bf1eUWoEEdSGIfO KjwU7mrdzltM1rXtZ3vZNMOGaAvX/c3ZRF5+eBTm/MGeeIe9A+0dtzZNfVSsu4I6BP uDBrg9KCG+SbA== MIME-Version: 1.0 Date: Tue, 31 Aug 2021 23:19:51 -0400 From: Steve Dondley To: Ray Andrews Cc: zsh-users@zsh.org Subject: Re: Best practices for managing aliases in ohmyzsh? In-Reply-To: <29064969-76d0-48a1-cb4a-719a9acaab29@eastlink.ca> References: <41fa241f119fdb9b8598293aad345823@dondley.com> <776abe09c579095258b2eef28a7ad5ca@dondley.com> <1ee1545904fdc1b5f473460cddfe5000@dondley.com> <29064969-76d0-48a1-cb4a-719a9acaab29@eastlink.ca> User-Agent: Dondley Message-ID: <0d01d3deb800e8506cffe86258c9e909@dondley.com> X-Sender: s@dondley.com Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Seq: 27042 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: > Yikes, I'm missing something fundamental.  In my head, executing a > script is identical to sourcing it.  It's not a binary, so what else > can there be than interpreting the file?  If a function is declared > (yes I know, wrong word but you get my meaning) then the function > enters memory, otherwise it's interpret-and-forget until next time, > no?  If 'chmod +x' then you don't hafta 'say' 'source me', it's > automatic, and it will be found if on the path, etc, but I'm laboring > under the idea that nothing else is different.  Is this going to > hurt?  I don't understand the lesson of Roman's example, so I think it > is going to hurt. The way I think about it is sourcing is basically like including the body of the text that's in the sourced file into your configuration file (or whatever file is sourcing it). After everything is sourced, it all gets dumped into memory. Nothing is executed, unless, of course, you actually have a bit of code in your sourced files that runs some commands which will get executed during the sourcing process. Scripts should not be sourced at all. Those have commands that will be executed. Roman is just saying to call those scripts directly. For example, I plan on calling them from aliases. His argument is that the hassle of setting up functions is too high and it's much easier just to use scripts which can use any programming language rather than having to be written in zsh. This also makes it much easier to switch to another shell. I believe functions are not stored in memory until they are called at least once in zsh if they are loaded with "autoload." I could be entirely wrong on this so someone please tell me if I am.