From owner-freebsd-questions@freebsd.org Sat Feb 4 03:49:03 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 53473CCCF21 for ; Sat, 4 Feb 2017 03:49:03 +0000 (UTC) (envelope-from drosih@rpi.edu) Received: from smtp9.server.rpi.edu (smtp9.server.rpi.edu [128.113.2.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "canit.localdomain", Issuer "canit.localdomain" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 2728A6BF for ; Sat, 4 Feb 2017 03:49:02 +0000 (UTC) (envelope-from drosih@rpi.edu) Received: from smtp-auth1.server.rpi.edu (smtp-auth1.server.rpi.edu [128.113.2.231]) by smtp9.server.rpi.edu (8.14.4/8.14.4/Debian-8+deb8u1) with ESMTP id v143mo3v005622 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 3 Feb 2017 22:48:51 -0500 Received: from smtp-auth1.server.rpi.edu (localhost [127.0.0.1]) by smtp-auth1.server.rpi.edu (Postfix) with ESMTP id 4965F58099; Fri, 3 Feb 2017 22:48:50 -0500 (EST) Received: from [128.113.24.47] (gilead-qc124.netel.rpi.edu [128.113.124.17]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: drosih) by smtp-auth1.server.rpi.edu (Postfix) with ESMTPSA id 22A7758002; Fri, 3 Feb 2017 22:48:49 -0500 (EST) From: "Garance A Drosehn" To: "James B. Byrne" Cc: freebsd-questions@freebsd.org Subject: Re: Variable assignment in sh Date: Fri, 03 Feb 2017 22:48:49 -0500 Message-ID: <6DCAA321-F6E4-4430-8851-8380F589DF13@rpi.edu> In-Reply-To: <7df89058c8e1c2078611909cdb150e4c.squirrel@webmail.harte-lyne.ca> References: <7df89058c8e1c2078611909cdb150e4c.squirrel@webmail.harte-lyne.ca> MIME-Version: 1.0 X-Mailer: MailMate (1.9.6r5319) X-Virus-Scanned: ClamAV using ClamSMTP X-Bayes-Prob: 0.0001 (Score 0, tokens from: outgoing, @@RPTN) X-Spam-Score: 0.00 () [Hold at 10.10] X-CanIt-Incident-Id: 02SErMO8G X-CanIt-Geo: ip=128.113.124.17; country=US; region=New York; city=Troy; latitude=42.7495; longitude=-73.5951; http://maps.google.com/maps?q=42.7495,-73.5951&z=6 X-CanItPRO-Stream: outgoing X-Canit-Stats-ID: Bayes signature not available X-Scanned-By: CanIt (www . roaringpenguin . com) on 128.113.2.229 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 03:49:03 -0000 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. Also note that I **did** say that my suggestion was a minor tangent, and thus I realize it was not necessarily on-topic. :) I just thought that some people who read this thread might find the site to be helpful. Cheerio. -- Garance Alistair Drosehn = drosih@rpi.edu Senior Systems Programmer or gad@FreeBSD.org Rensselaer Polytechnic Institute; Troy, NY; USA