From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from minnie.tuhs.org (minnie.tuhs.org [45.79.103.53]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 224a15a0 for ; Sat, 4 Jan 2020 23:02:31 +0000 (UTC) Received: by minnie.tuhs.org (Postfix, from userid 112) id 1507A951BF; Sun, 5 Jan 2020 09:02:30 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id 9E7C295189; Sun, 5 Jan 2020 09:01:59 +1000 (AEST) Authentication-Results: minnie.tuhs.org; dkim=pass (2048-bit key; unprotected) header.d=jon-es.20150623.gappssmtp.com header.i=@jon-es.20150623.gappssmtp.com header.b="ZYhdYJwK"; dkim-atps=neutral Received: by minnie.tuhs.org (Postfix, from userid 112) id 290649516C; Sun, 5 Jan 2020 09:01:56 +1000 (AEST) Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) by minnie.tuhs.org (Postfix) with ESMTPS id 2974E95165 for ; Sun, 5 Jan 2020 09:01:55 +1000 (AEST) Received: by mail-lj1-f174.google.com with SMTP id o13so35851335ljg.4 for ; Sat, 04 Jan 2020 15:01:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jon-es.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=X895F6TfyvNaVNtQ680uXJNsUtS4FqC2iHgFrE89dxo=; b=ZYhdYJwKhtWTEK0AZI7vsNX6hkDgQdd2c490KMO5RlVfl8isaf41tLZ7/d2dku7hAG AlohKRHy09a+rbXcuKJYJnoqfgpGz+z0pf63PiZWeSZZSdQM01Wtu0pS7xYCfsWAWKzy +jM90j5NDKuA/HsU22ShH5zTLs0XIiJHWCp1hVPaJmFTDxL4dWh2o8+Bv7SWll1dnbKn sfIUu0efmikd91GQEKWm5Ccom7RQ65XED0thQGVmLuLtN+v9+dLKwkj1GaxbjLJalBKx zM+P832TFYdT23G4YlKHvtJA61CGldEahvfOQrgDW0jeevtYG0FrSkJRhvD7r7lAN0OM LRVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=X895F6TfyvNaVNtQ680uXJNsUtS4FqC2iHgFrE89dxo=; b=VAhrSdO07NwpDuWx3vAFMrU/nSnHy9kfDAp0Ht+yKT8mx2l18A8x9g7n4U+USX4lk1 hIpPb9zedFVP85x+XUNMxfzpSVhAPp3RdxPMctoNQei6sLz0Y/3vawRIRLUx9nyOWTFg AZHKv+qbb+nvtjWakfjf78x7r2kCqCYc65rW7nLUwgkmLsnzGC0sSl0A8S3H+i1VoLFB +uJfO0qK6OOTxXn/f0iz8l6RRswMNKXiQOFp3SqKL8PJy5qL+0p1alTKZ8gdnl4x0DyX RZUWMaPLB+MhdZK2fw3ntFDsu8bMu4zbx9O0Et7UeEYoHnNjblv0uxZnNDM0r4DJYPj4 zw9g== X-Gm-Message-State: APjAAAUseu/j5UFgTTerCUYNNJfCSx5dKRdjtDqHzmqLwFeaSBEdY4yS ZFjNgJp0gQ21CyT5xb2GroWLw4gZ286dS5GrTRyO+A== X-Google-Smtp-Source: APXvYqx4sitmAGQcnpX2D90BTpieq+CkIaviERr8JeakKPoAz7kicjdz58m00wh0KvjHAEMM3KZNan/eUQ20oBVddXc= X-Received: by 2002:a2e:9ad8:: with SMTP id p24mr56069682ljj.148.1578178913511; Sat, 04 Jan 2020 15:01:53 -0800 (PST) MIME-Version: 1.0 References: <202001040258.0042wuic1359237@mail.cs.dartmouth.edu> <1ingL0-5g6-00@marmaro.de> <1ins9r-4KA-00@marmaro.de> In-Reply-To: <1ins9r-4KA-00@marmaro.de> From: Terry Jones Date: Sun, 5 Jan 2020 00:01:42 +0100 Message-ID: To: markus schnalke Content-Type: multipart/alternative; boundary="000000000000882cda059b58694e" Subject: Re: [TUHS] sh: cmd | >file X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: tuhs@minnie.tuhs.org Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" --000000000000882cda059b58694e Content-Type: text/plain; charset="UTF-8" On Sat, Jan 4, 2020 at 11:45 PM markus schnalke wrote: > > > but : is much nicer because you can "comment" out a > > single command in (e.g.) an if/then and it remains syntactically valid > and > > executable. I find it very elegant. > > Can you please give an example for me to understand what you mean > by that? > While developing, I frequently have some code like: if test -f somefile then cmd1 cmd2 else echo somefile is missing fi I have the "else" clause because I initially want to explicitly see some output in that case. A bit later if I temporarily don't want the output (but want to keep the else and the echo line around) I can just put a colon before the echo. You can't do that with a # because you get a syntax error. And if you wanted to use # you'd then have to put in some other do-nothing line (maybe a : by itself) to keep valid syntax. In a situation like this I will eventually end up deleting the echo line and the preceding else, but during development I like being able to use : in this way. Terry > > meillo > --000000000000882cda059b58694e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Sat, Jan 4, 2020 at 11:45 PM markus sc= hnalke <meillo@marmaro.de> w= rote:

> but : is much nicer because you can "comment" out a
> single command in (e.g.) an if/then and it remains syntactically valid= and
> executable. I find it very elegant.

Can you please give an example for me to understand what you mean
by that?

While developing, I frequently= have some code like:

<= span style=3D"font-family:monospace">if test -f somefile
then=
=C2=A0=C2=A0=C2=A0 cmd1
=C2=A0=C2=A0=C2=A0 cmd2
else<= /div>
= =C2=A0=C2=A0=C2=A0 echo somefile is missing
fi

=
I have the "else" clause because I initially want to e= xplicitly see some output in that case. A bit later if I temporarily don= 9;t want the output (but want to keep the else and the echo line around) I = can just put a colon before the echo. You can't do that with a # becaus= e you get a syntax error. And if you wanted to use # you'd then have to= put in some other do-nothing line (maybe a : by itself) to keep valid synt= ax.=C2=A0 In a situation like this I will eventually end up deleting the ec= ho line and the preceding else, but during development I like being able to= use : in this way.

Terry

=


meillo
--000000000000882cda059b58694e--