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,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 29612 invoked from network); 7 Apr 2021 12:50:39 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 7 Apr 2021 12:50:39 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1617799839; b=0f6X1A06F+n9uBnm6gWfO7kkX/rz+Sc/OmfRogTXRAfcGoejQoxWznn0XYDom0ATYOcZ2ZNVAL 30smZ9bUtitA4Wu5/EayyXfwyMmyH4poo+ImVKxMlNlUZqL7L5SV5GQyfrqTxZ39/L4CpsZIyn uLLPJdiNNuMcJw1RMWIP0KV9vYacZZ13pZ5idmzGICoBwQdEILTUZ6rc8sPRdttuE/G3HzxtSz ho+XLTtIe785McJ8loLfF19MmuEZSWCMQjJFm2oPiqOUawT1fT0vQ98DMXodK7FdRGsKejnjbK Pgu5GDNBnpRq52eqF+QVblbss++Q61dvPKs7mP1iYgJ/8A==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail.covisp.net) smtp.remote-ip=65.121.55.42; dmarc=none header.from=covisp.net; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1617799839; bh=oZLWbh5Etzd7tr7b8zjQvN6+1XjALmaSB+zJKtqpPDc=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:To:References:Message-ID:Content-Transfer-Encoding:Date: In-Reply-To:From:Subject:Content-Type:DKIM-Signature; b=PRIpcCPhddoeNmyr9lTDIRSqyoyHl5akQdz9lC3C6UQCcaw42+2caxn/t97DmakxgZY7PW6iqy 9nfjyJ8ADFf4gtWlP2VTQWb6pRhz0ECrqEfOFZmw3b6RWUMxiiV1/bvgBrvVgaOWBaFhcJ9xB7 KaIm05M1ZA9mjNv0OEh05gsTl8vDzkLRBE/X11T5bKOppAM+7QH8u0TW50e99D8leYaGlzhHI5 N53OKLP+WyLCPi4Ul4LxsXcJ1hOs0dLck5nuSTmfAw4dwRCrlaHsD+dSziWGSBzrDiQHq/5raG 6rD6dmY2Bz0fJhDZeAW4RSghKDwr53ygjPcv8Fwyu22rQg==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:To:References:Message-Id: Content-Transfer-Encoding:Date:In-Reply-To:From:Subject:Content-Type:Reply-To :Cc:MIME-Version:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=ux+POvYFhL488pMzpc2h0055a8jSaP1BKOosKxEfGok=; b=09Wh1BUQ2/w1eVtjACfX+BJBfQ 7VCxGlzcmMkPNjs90duWwDGMHLOqVWy7/496+0WLpNUlljtxuCtrPPa7dUgO/xe61Mtp4lC9pwPiA 46tZLqnWlmCSDUoP44JolK71h+xUuHWsBxQFarXZQhhDn3KxAZ8ENLitJlWIG/DuwuiLwDuaSqAqo 430xh8wVSUFD+tK5kHxKCXquWOXxW3gViek6rWr/s/h8YHwXz7hExQtwTFVqZYg753tNzsgeLHkMa fQMAFd9pVkLP8v/awmUQT7X+QiAnjt8mtZGL+ygRCt537hY2ZXRX7CzowvZ/LNgp2F9lE89pdJVJj Ytej/rdw==; Received: from authenticated user by zero.zsh.org with local id 1lU7dm-000E1E-56; Wed, 07 Apr 2021 12:50:38 +0000 Authentication-Results: zsh.org; iprev=pass (mail.covisp.net) smtp.remote-ip=65.121.55.42; dmarc=none header.from=covisp.net; arc=none Received: from mail.covisp.net ([65.121.55.42]:16823) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1lU7cA-000DFX-Rt; Wed, 07 Apr 2021 12:49:00 +0000 Content-Type: text/plain; charset=utf-8 Subject: Re: alias with a parameter From: lb@covisp.net In-Reply-To: <20210407070518.szoet4rxbouwzelm@chazelas.org> Date: Wed, 7 Apr 2021 06:48:56 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: References: <20210407070518.szoet4rxbouwzelm@chazelas.org> To: zsh-users@zsh.org X-Mailer: Apple Mail (2.3654.80.0.2.43) X-Seq: 26631 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 07 Apr 2021, at 01:05, Stephane Chazelas = wrote: > 2021-04-05 20:47:47 -0600, Grant Taylor: > [...] >> pd() { >> [ -n "${1}" ] && pushd "${1}" || popd; >> } >>=20 >> It's using parameters on a function, just like you're trying to do. = It >> works a treat. >>=20 >> Aside: Yes, I'm lazy and don't want to type pushd or popd. Instead, = the pd >> function determines which command to run based on if $1 is set or = not. > [...] >=20 > That function would run popd when pushd fails. It's generally a > bad idea to use this kind of a && b || c in place of proper > if/then/else constructs. Bad idea, or just a style "this is proper practice" sort of thing? I can't imagine any 'bad idea' from this, as it is doing the same basic = thing. --=20 =C9=B9=D7=9F=CA=87nq=D7=9F tel:+1.303.219.0564