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,NICE_REPLY_A,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 5571 invoked from network); 27 Apr 2021 07:12:22 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 27 Apr 2021 07:12:22 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1619507542; b=z1qNtieZ27I6VVqxWemFHcEVLgMUAolDAru8eaPW/BMQQfpw8m9qdN37JU0c+8xnNRxdg4xMaN 2v1JsQPw5Azfo1hpRofTxRpqfr7A8PRt+awZiRTvekpeVw2MQVGlU3uvruV1433gmp2q7uT33K 8GQfHfODdzOSZiRvI31Ym0rULisIJJN4f/d/QBHeLpS95d+MoO02rxyGrb7WUjOJ6W1N0ovQmZ R9+QnqH4cMqRnGE6XxQU9oRAI37wsENEqw5sSsn74b+YfleRXJyuOkIFxOXFQK9B28PU9xK8jC ZNn4twzoCOrs+Svv0rZdU8BQ891HGBB+OhTa7GyNij8qRQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (p3plsmtp21-01-2.prod.phx3.secureserver.net) smtp.remote-ip=68.178.252.47; dmarc=none header.from=rayninfo.co.uk; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1619507542; bh=JSp7r2rnb1jGrYxcIdp50jJ1mbklKCRGQ6wV+fLdhTA=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:To:Subject:DKIM-Signature; b=SlG8RZ7Zkh9wOAvMx7gi8+3hC1+oggM5tGjeOZEUYTvNBpQ+112Y5SN8nFlEBaIKO+cI+sibo8 +7DJklOT0Xip1iHCuBxm+h3VcVMZynqtuow8i4bTHfTi8FlrHqtftAg+9xFwTgzVi+S42iqxmk avHnmqBkjDPRxH1k6XvMjAI+bfjQPD7RQqE4uK0rL/2WC6zvuDcksT2tc9FEg+cLwqbsdzg2xh JBmjiOsrBc7GZCBIhH/cJiY6+n30FhcFYk1HvvDby2qEAFSuBKprWxotQ/u52zL9D/h15QHvX7 i61iGZCdmmrIHERcMhzZlNFbzagJBsqv1dwR/LF6tWhoRw==; 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:Content-Transfer-Encoding: Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:To: Subject:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=5lTKmhz6rXq0o+oYQl3rlhWGGBekUEPOv+Ve9QhQGj8=; b=ifv/DauPMTQK78om46qjKlwQiU SCZOCH4rTy04Ld6DNC+9B5Ujt8qTDRAe9e5y3Vcq4Rjm9TYZAyo0Z2+yd61PFfEqfisX1qDWm8pr3 IrVYrjUrV38Q/UH4frGHHc26EWjERnSiPMDzVBrx1LszSkTlPs5rIDhV87qJ6oV3Oa0B1FhOMF/o9 o05SBQN8ERr7tOaScft3HeuJaXKEMHBBfzMm5SdJn/xnVEQqwXaNuDVrLEo1PPxjos035UUm3nosx Kl63mPVGaBeewWIXZeVDhHnQfgMInogRh7q7Y7iKjIS3ZFVreBi8pqCIRfyVo2ifwG1FVm+572xb6 jb+zQOjg==; Received: from authenticated user by zero.zsh.org with local id 1lbHtN-000FI7-09; Tue, 27 Apr 2021 07:12:21 +0000 Authentication-Results: zsh.org; iprev=pass (p3plsmtp21-01-2.prod.phx3.secureserver.net) smtp.remote-ip=68.178.252.47; dmarc=none header.from=rayninfo.co.uk; arc=none Received: from p3plsmtp21-01-2.prod.phx3.secureserver.net ([68.178.252.47]:35219 helo=p3plwbeout21-01.prod.phx3.secureserver.net) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1lbHs2-000EgI-Rw; Tue, 27 Apr 2021 07:10:59 +0000 Received: from mailex.mailcore.me ([94.136.40.141]) by :WBEOUT: with ESMTP id bHrzlRDcUysi3bHrzlg50u; Tue, 27 Apr 2021 00:10:56 -0700 X-CMAE-Analysis: v=2.4 cv=AMltMv3f c=1 sm=1 tr=0 ts=6087b900 a=bheWAUFm1xGnSTQFbH9Kqg==:117 a=MSuxXlsgQg/r+Vijqd6nqw==:17 a=toa1DQ_u1RAA:10 a=IkcTkHD0fZMA:10 a=3YhXtTcJ-WEA:10 a=LnLr5WFci1GM-6dl0OYA:9 a=QEXdDO2ut3YA:10 X-SECURESERVER-ACCT: zsh@rayninfo.co.uk X-SID: bHrzlRDcUysi3 Received: from [95.150.51.97] (helo=[192.168.1.231]) by smtp06.mailcore.me with esmtpa (Exim 4.92.3) (envelope-from ) id 1lbHry-0003rc-CP for zsh-users@zsh.org; Tue, 27 Apr 2021 08:10:54 +0100 Subject: Re: Alias help To: zsh-users@zsh.org References: <82B6395B-6043-42A1-A3FD-8B4F42C3A756@iu.edu> From: zzapper Message-ID: Date: Tue, 27 Apr 2021 08:10:54 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Mailcore-Auth: 8308408 X-Mailcore-Domain: 840527 X-122-reg-Authenticated: 8308408 X-Originating-IP: 95.150.51.97 X-CMAE-Envelope: MS4xfNUy0iJFTlV94hFEZrpeyIx4dMmGV0sraa5fwjPh94k4tLJhAiU7ZpO78wykjpOQGtAGUfC9yGCuO8ex7pqx7j512S2524Oe3j1QQZMBSxMvi9NXZ+he yaKAh69/zU5J4Cqx6tRTOlnszwpngUZjDQ0cB33InYDBPllAtRkPrb0IXfKNmIL51CWKAFORUIDkow== X-Seq: 26705 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 27/04/2021 00:15, Eric Cook wrote: > On 4/26/21 6:55 PM, Hoji, Aki wrote: >> alias pu ="pip3 list -o | sed "1,2 d" |cut -d ' ' -f1 |  xargs -n1 >> pip3 install -U” > > As a shell function: > pu() { ~ >   pip3 list -o   | >   sed "1,2 d"    | >   cut -d ' ' -f1 | >   xargs -n1 pip3 install -U > } > > While not to the degree of say python, whitespace matters often in shell; > You have an extra space after the name of the alias pu, so the =word > triggered a different > feature of zsh that expands the path to a command. in this case "pip3 > list -o | sed 1,2" > once you remove the space you still have the problem of not quoting > correctly. > > alias pu='pip3 list -o | sed "1,2 d" |cut -d '\'' '\'' -f1 | xargs -n1 > pip3 install -U' > > Is how to quote that command properly, which is less readable than a > function is in my opinion. > thanks for this explanation Eric (I've been having my own battles with shell white space recently) When you are desperate to get something working not noticing a little thing like the extra space in >>>>alias pu ="pip3<<< Pity we don't have an online script tester for zsh (many for bash) I prefer an Alias to a Function where possible because it's easy to tab expand an alias and then if required tweak it