From owner-freebsd-questions@freebsd.org Sat Feb 4 04:03:47 2017 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17933CD069F for ; Sat, 4 Feb 2017 04:03:47 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mailrelay13.qsc.de (mailrelay13.qsc.de [212.99.187.253]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.antispameurope.com", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 714E9F7F for ; Sat, 4 Feb 2017 04:03:45 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx01.qsc.de ([213.148.129.14]) by mailrelay13.qsc.de; Sat, 04 Feb 2017 05:05:39 +0100 Received: from r56.edvax.de (port-92-195-126-61.dynamic.qsc.de [92.195.126.61]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx01.qsc.de (Postfix) with ESMTPS id 1E4603CC3F; Sat, 4 Feb 2017 05:03:34 +0100 (CET) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id v1443YbA003824; Sat, 4 Feb 2017 05:03:34 +0100 (CET) (envelope-from freebsd@edvax.de) Date: Sat, 4 Feb 2017 05:03:34 +0100 From: Polytropon To: "Garance A Drosehn" Cc: "James B. Byrne" , freebsd-questions@freebsd.org Subject: Re: Variable assignment in sh Message-Id: <20170204050334.b7c3ea7c.freebsd@edvax.de> In-Reply-To: <6DCAA321-F6E4-4430-8851-8380F589DF13@rpi.edu> References: <7df89058c8e1c2078611909cdb150e4c.squirrel@webmail.harte-lyne.ca> <6DCAA321-F6E4-4430-8851-8380F589DF13@rpi.edu> Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-cloud-security-sender: freebsd@edvax.de X-cloud-security-recipient: freebsd-questions@freebsd.org X-cloud-security-Virusscan: CLEAN X-cloud-security-disclaimer: This E-Mail was scanned by E-Mailservice on mailrelay13.qsc.de with 1DD2569E89B X-cloud-security-connect: mx01.qsc.de[213.148.129.14], TLS=1, IP=213.148.129.14 X-cloud-security: scantime:.2730 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Feb 2017 04:03:47 -0000 On Fri, 03 Feb 2017 22:48:49 -0500, Garance A Drosehn wrote: > On 3 Feb 2017, at 17:25, James B. Byrne wrote: > > > On Wed, February 1, 2017 19:21, Garance A Drosehn wrote: > > > >> > >> On something of minor tangent, if you're writing scripts in > >> either 'sh' or 'bash', you may find the following web site > >> helpful: http://www.shellcheck.net > > > > > > I just wish to clarify something here. What I am doing is attempting > > to reuse a one-liner that has one conditional in it. I do not > > consider that to be scripting or programming. I am just piping > > a few tools together and checking if anything comes out the end. > > Understood, but even those trivial one-liner tasks might be improved > by pasting them into shellcheck. I've had shellcheck point out things > I'm doing which "almost always" work, but will fail depending on the > filenames my one-liner happens to be working on. In this case, the follwing articles might be helpful in the future: David A. Wheeler: Filenames and Pathnames in Shell: How to do it Correctly https://www.dwheeler.com/essays/filenames-in-shell.html And: David A. Wheeler: Fixing Unix/Linux/POSIX Filenames: Control Characters (such as Newline), Leading Dashes, and Other Problems https://www.dwheeler.com/essays/fixing-unix-linux-filenames.html -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...