From owner-freebsd-questions@freebsd.org Mon Oct 26 01:57:00 2020 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CC30D45E830 for ; Mon, 26 Oct 2020 01:57:00 +0000 (UTC) (envelope-from drosih@rpi.edu) Received: from mailman.nyi.freebsd.org (mailman.nyi.freebsd.org [IPv6:2610:1c1:1:606c::50:13]) by mx1.freebsd.org (Postfix) with ESMTP id 4CKHyN4TlZz4pXp for ; Mon, 26 Oct 2020 01:57:00 +0000 (UTC) (envelope-from drosih@rpi.edu) Received: by mailman.nyi.freebsd.org (Postfix) id 99D8C45E906; Mon, 26 Oct 2020 01:57:00 +0000 (UTC) Delivered-To: questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 999F245E82F for ; Mon, 26 Oct 2020 01:57:00 +0000 (UTC) (envelope-from drosih@rpi.edu) Received: from smtp7.server.rpi.edu (smtp7.server.rpi.edu [128.113.1.207]) (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 4CKHyM55Ssz4pVm for ; Mon, 26 Oct 2020 01:56:59 +0000 (UTC) (envelope-from drosih@rpi.edu) Received: from mail-auth1.server.rpi.edu (mail-auth1.server.rpi.edu [128.113.1.231]) by smtp7.server.rpi.edu (8.14.4/8.14.4/Debian-8+deb8u2) with ESMTP id 09Q1up4w087616 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 25 Oct 2020 21:56:51 -0400 Received: from mail-auth1.server.rpi.edu (localhost [127.0.0.1]) by mail-auth1.server.rpi.edu (Postfix) with ESMTP id A19BF5804D; Sun, 25 Oct 2020 21:56:51 -0400 (EDT) Received: from [128.113.125.57] (calyx-57.net.rpi.edu [128.113.125.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: drosih) by mail-auth1.server.rpi.edu (Postfix) with ESMTPSA id 653B15804B; Sun, 25 Oct 2020 21:56:51 -0400 (EDT) From: "Garance A Drosehn" To: "Robert Huff" Cc: questions@freebsd.org Subject: Re: sh scripting question Date: Sun, 25 Oct 2020 21:56:06 -0400 X-Mailer: MailMate (1.13.2r5673) Message-ID: In-Reply-To: <24456.60388.135834.43951@jerusalem.litteratus.org> References: <24456.60388.135834.43951@jerusalem.litteratus.org> MIME-Version: 1.0 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] HTML_MESSAGE:0.001 X-CanIt-Incident-Id: 083IpUPUX X-CanIt-Geo: ip=128.113.125.57; country=US; region=New York; city=Troy; latitude=42.7273; longitude=-73.6696; http://maps.google.com/maps?q=42.7273,-73.6696&z=6 X-CanItPRO-Stream: outgoing X-Canit-Stats-ID: Bayes signature not available X-Scanned-By: CanIt (www . roaringpenguin . com) on 128.113.1.207 X-Rspamd-Queue-Id: 4CKHyM55Ssz4pVm X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=pass (policy=none) header.from=rpi.edu; spf=pass (mx1.freebsd.org: domain of drosih@rpi.edu designates 128.113.1.207 as permitted sender) smtp.mailfrom=drosih@rpi.edu X-Spamd-Result: default: False [-3.53 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:128.113.1.200/29]; NEURAL_HAM_LONG(-1.00)[-1.003]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; NEURAL_HAM_MEDIUM(-1.00)[-0.997]; RCVD_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.73)[-0.733]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[rpi.edu,none]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:91, ipnet:128.113.0.0/16, country:US]; RCVD_TLS_LAST(0.00)[]; MAILMAN_DEST(0.00)[questions] Content-Type: text/plain X-Content-Filtered-By: Mailman/MimeDel 2.1.33 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Oct 2020 01:57:00 -0000 On 15 Oct 2020, at 20:40, Robert Huff wrote: > I have a file ("files.list") with a list of filenames, similar to > > /path A/path B/FreeBSD is great.txt > > (note the embedded spaces) > If I use > > for FILE in `cat files.list` > > FILE will be set to "/path". > How do I get it to read the entire string? You will (perhaps) be surprised at how much you can get done with a simple bourne or bash shell script, if you have something which can look at your code and give helpful hints. One way to get those hints would be to use 'shellcheck'. There is a port for shellcheck, and you can also try it out at https://www.shellcheck.net without needing to install anything on your own machines. Take the code you wrote, paste it into the shellcheck window, and it'll find whatever risky things are in that code. And it will suggest alternatives. You can also put comments in your code which will tell shellcheck "Yes, I really did mean to do this risky thing, so do not warn me about it". I think it's very useful. -- Garance Alistair Drosehn = drosih@rpi.edu Lead Developer @rpi and gad@FreeBSD.org Rensselaer Polytechnic Institute; Troy, NY; USA