From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1038 invoked by alias); 7 Sep 2016 05:01:23 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 21843 Received: (qmail 2281 invoked from network); 7 Sep 2016 05:01:22 -0000 X-Qmail-Scanner-Diagnostics: from bart.luffy.cx by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(78.47.78.131):SA:0(-1.1/5.0):. Processed in 0.433464 secs); 07 Sep 2016 05:01:22 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=RP_MATCHES_RCVD,SPF_PASS, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: bernat@luffy.cx X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at luffy.cx designates 78.47.78.131 as permitted sender) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=luffy.cx; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=postfix; bh=j10vvFfOidJzS8mWChEgYYrgvw8=; b=hqH XINL/Qu4XgYLyBU5h8C+iAwkMvBX/eILJyXRwYetDuoPHryUht/nTNapiNK5/h3v hSql9Z92tqGgAn/fNCkuL8NRtpjt6RupT/tLSJqnRSY2A11q2nKVJzUzWZuNS/y1 iG8E+4Blui3ide8nIPjKPLUXEmvLkzc/m9UMrjBU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=luffy.cx; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=postfix; b=kIQxOHlmO0kLGQwa4uB4KtCUXvuwG 1rw0LZzBst6Hsri4i7Te8hsIYnwnSEZKEQM1DfMmuPoD1ecSVQaeAMFKq6V300OP ZI1eI3x8dcbLcFhRJsJtP9Ca19FB62PdCamYBtK24Tf65Sm31WAie3sQ9xih3ndX +T5YfXkPSNnhtY= From: Vincent Bernat To: =?utf-8?Q?Ren=C3=A9?= Wilhelm Cc: Zsh Users Subject: Re: Undoing mv foo.txt{,_} References: Date: Wed, 07 Sep 2016 06:54:15 +0200 In-Reply-To: (=?utf-8?Q?=22Ren=C3=A9?= Wilhelm"'s message of "Tue, 6 Sep 2016 19:04:05 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable =E2=9D=A6 6 septembre 2016 19:04 CEST, Ren=C3=A9 Wilhelm =C2=A0: > What's a good way to move file.txt_ back to file.txt, or more general: how > to remove the suffix of a string, without putting it in a variable first > (e.g. a=3Dfoo.txt; mv $a $a:r)? About not using a variable, there is the ${:-...} pattern: echo ${${:-foo.txt}:r} --=20 Make sure all variables are initialised before use. - The Elements of Programming Style (Kernighan & Plauger)