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 2636 invoked from network); 31 Aug 2021 21:23:28 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 31 Aug 2021 21:23:28 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1630445008; b=D4Bgmr/bgvxQGDwL66V6Coi3bHB0AFrkmyRAz1lgq7Jcc4yxez4YFpJIOnjOPCuCtIfhN2mNZD AyUrc5ROj5Y0NdIB4lnQsIKVAytkxbhUdA3n/CmC/PX+60jSSl1e07LhRkpvKdLKRKe9utmL88 fFu+m9i5o0dJwrRSUOA+zAY9t+d7Kjs2iXk1xM0X3NTgTSkkzMDNsiSXignUOpLT9y/5wvxFUn h1NIFxZWLhXyF+0Tq0w5kgistAw65PjKcVL4/2WqcKsGC5Lqh8oNy7OnvbBlUvwijhB5z3uYpk R1/6sFHvsVMR6QkvXXcsRV6bBQKpN5owlXhuRNi1RLOA6Q==; 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=1630445008; bh=5Cb9ZujIf9rej/kB6aMqi5uUpt8pmo8P590YpdgjKqI=; 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:To:From:Date:MIME-Version:DKIM-Signature:DKIM-Signature; b=iFg3MCRBMX4AaDn8Y45BYg78xEKeZKPCUx/2l5fT9uyvvO4YBz76w387QUzWvVzuilAauh0wIz jy92UxtgNUEhS95Gx0mZ0id+cR8cZzLIxKEFEayjY2pzGf6kJPUNMkWQzFWk2XrWGo9yIvYJjr J7it6yhQjLgrcKp9XHccbg64ziFmOJIBpD11iIJhYgBGvya9Li54MIsbArEjnE7/wOjt+Nh3yU X/4wdAm7SFBcA6O36Yroxc2CwUzq0nHKUdfdPIM53oCmKPrgCasJbH/pV8zrdliJxjxTa0ELCm mBYXv7UCvaSXwxXp69MtcnB+VAVgqw/fuM2/D3TXCbFDiw==; 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:To:From:Date: MIME-Version:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=1DNuyt1nADS7T6xI4ymih9oSHf3Pb9eocSDrAebGXxs=; b=RGwkQfwG7dd4clWFeVk5y2LtGI iNeDqDg3XvX0vv0QeBv4chLOCrgtqNTEZLli/znq6Kuz2PWtjpueMhyK29gRjRFcamzBwvKbwBLhh M6z+c+AIp6rJbb+oySZQjov8OFamFSgACNB3pcMhUSUrUxBpju+9I20erBgsqP0I37J1vvGw/sIOz ftTlVFZrzXaawwLZqz7HZO1u/jO7TsskdFrfF0x2vgJ7TNsxvpJ2MFVDvNocm+N5vbUfk0Il5q2uJ 2G8CgRL6KcFc1/ki/NnkpXlZ+ut0pPv1PkMQYHu03bVrFoVyOTZrMrPQ+ugohzxIpQbp7IggJgexQ odOAyamQ==; Received: from authenticated user by zero.zsh.org with local id 1mLBE7-0003LI-Vp; Tue, 31 Aug 2021 21:23:28 +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]:44960) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1mLBDP-0002eO-ME; Tue, 31 Aug 2021 21:22:44 +0000 Received: from email.dondley.com (email.dondley.com [34.203.132.18]) by email.dondley.com (Postfix) with ESMTPSA id E8D9A208EE for ; Tue, 31 Aug 2021 17:22:40 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=dondley.com; s=default; t=1630444960; bh=5Cb9ZujIf9rej/kB6aMqi5uUpt8pmo8P590YpdgjKqI=; h=Date:From:To:Subject:In-Reply-To:References:From; b=bJRd9RLcMid8+QnkeV02FQhiTARXT4OLIoL307TKyFTiqkHfMjNTmVJMbFRpfJBUU wynWPTjyG01O70qYRgjsZJs/6eRlzC/RLtnfeRJU+JpysQLsHsLmRaimYolPr899Y0 +dTk6TJ9QE6zHr9X772Q3NmkerqKlaNu4FGPV2L3E5ZdLwY2ZlQ5SvGXoNPhJClnRR JKrLYh/Ca8klhLfG0MNv9ZrDvLZ4hRiX0NY8WHoq/FBAJ3+TTTCByTfhe7Cv91qJt4 VOa4dIsyg+ACUogMsHJw+KfwyWeqaIHqaqbAFET4mzn7CF5ydEsk9ytE5Cj2PzmSzD 6ZE4aRMHlz/dw== MIME-Version: 1.0 Date: Tue, 31 Aug 2021 17:22:39 -0400 From: Steve Dondley To: zsh-users@zsh.org Subject: Re: Best practices for managing aliases in ohmyzsh? In-Reply-To: References: <41fa241f119fdb9b8598293aad345823@dondley.com> <776abe09c579095258b2eef28a7ad5ca@dondley.com> <1ee1545904fdc1b5f473460cddfe5000@dondley.com> User-Agent: Dondley Message-ID: X-Sender: s@dondley.com Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Seq: 27033 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: > If you put this in an executable file in your PATH, it'll be a script. > I recommend doing that. You can also create a function with that body > but that would be worse. > >> I don't call this function directly, it is only called from an alias > > Aliases can invoke scripts just as easily as they can invoke functions. > > Roman. So to sum up, it sounds like your advice is "Always use a script instead of a function. If the script can't work for whatever reason, then use a function." I will do this. To keep things organized, I think I set up a subdirectory called ~/bin/shell_alias_scripts, add it to $PATH and toss all the scripts that are used by aliases in there. And so long as I only call these scripts with an alias, there shouldn't be any performance penalty because they won't all have to be sourced by zsh. Thanks!