From owner-freebsd-questions@freebsd.org Sun Oct 18 20:38:05 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 F3E1B43B07B for ; Sun, 18 Oct 2020 20:38:05 +0000 (UTC) (envelope-from bob@proulx.com) Received: from havoc.proulx.com (havoc.proulx.com [96.88.95.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CDsCc4fwPz4vds for ; Sun, 18 Oct 2020 20:38:04 +0000 (UTC) (envelope-from bob@proulx.com) Received: from joseki.proulx.com (localhost [127.0.0.1]) by havoc.proulx.com (Postfix) with ESMTP id 96F385C4 for ; Sun, 18 Oct 2020 14:37:56 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proulx.com; s=dkim2048; t=1603053476; bh=yRA/IIZ+6RAHBRF66VVWWN7guuRDV1CgpOonTDxsuQw=; h=Date:From:To:Subject:References:In-Reply-To:From; b=q+LSwCkdV0Te9A5y9UtzCFMLwtyHDu0pt+Nx0JKHaGCt9AG10QfXmQ0UL81kkt9JY gnVj+FwK3oMu5B0zWBwqZrKhBxgY4OXvaccoWoR8xdAIib33rT9evMoXh0mTWP6vR7 uLfg1rcoaXv77sT01lBk4HyL7aSCUVWKKf8YZixpDJwb039rEenG/6+CiEl7f3L4Wq s8eTTQ01ANSdE4eGOhvPbz66yZk84FBgTO6Ywh/xfGYDDlhGRSS6V7aCI/Mt+yPYAD X1643POjUAuMBiU0mVALfoer6/LFlAogQq4lzm/hnTETJiAOAdvP+0K6QD6vkNDj+W 45pEE8CZP3GHA== Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119]) by joseki.proulx.com (Postfix) with ESMTP id 712A321144 for ; Sun, 18 Oct 2020 14:37:56 -0600 (MDT) Received: by hysteria.proulx.com (Postfix, from userid 1000) id 3AD222DC9D; Sun, 18 Oct 2020 14:37:56 -0600 (MDT) Date: Sun, 18 Oct 2020 14:37:55 -0600 From: Bob Proulx To: freebsd-questions@freebsd.org Subject: Re: sh scripting question Message-ID: <20201018141345096243637@bob.proulx.com> References: <24456.60388.135834.43951@jerusalem.litteratus.org> <20201015204226099763897@bob.proulx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4CDsCc4fwPz4vds X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=proulx.com header.s=dkim2048 header.b=q+LSwCkd; dmarc=pass (policy=none) header.from=proulx.com; spf=pass (mx1.freebsd.org: domain of bob@proulx.com designates 96.88.95.61 as permitted sender) smtp.mailfrom=bob@proulx.com X-Spamd-Result: default: False [-3.57 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.05)[-1.055]; R_DKIM_ALLOW(-0.20)[proulx.com:s=dkim2048]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+a]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-0.98)[-0.980]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[proulx.com:+]; DMARC_POLICY_ALLOW(-0.50)[proulx.com,none]; NEURAL_HAM_SHORT(-0.53)[-0.533]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:7922, ipnet:96.64.0.0/11, country:US]; MAILMAN_DEST(0.00)[freebsd-questions] 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: Sun, 18 Oct 2020 20:38:06 -0000 Kurt Hackenberg wrote: > Bob Proulx wrote: > > > Oh you are tormenting us now. :-) There are some subtle issues here. > > Maybe a shell is the wrong tool. And yet just the same the shell does handle whitespace and arbitrary characters in file names easily. while IFS= read -r line; do printf "|%s|\n" "$line" done < file1 It's a shell programming idiom. It accomplishes the task very easily. For people programming in the shell every day this type of construct rolls off the fingers like a native language. But it may not be immediately obvious without a hint that this is what is needed. Idiom, id-ee-uhm, noun. An expression conforming or appropriate to the peculiar structural form of a language. Nothing we have seen yet makes the shell the wrong tool. The shell is a very powerful command and control language. And so far the original need was still for using it specifically as a command and control language. So all good so far! If we move to needing complex data structures however that is where my decision point is set to move to a language that supports complex data types. And I think everyone is in agreement that the filenames that were chosen were not the file names that any Unix person would choose to name their files. No disagreement there. I am sure they were chosen by less enlightened individuals. Given that the files on disk were chosen for a different purpose then can we handle them easily in the shell? Yes. So far nothing too difficult! :-) Bob