Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 25 Oct 2020 21:56:06 -0400
From:      "Garance A Drosehn" <drosih@rpi.edu>
To:        "Robert Huff" <roberthuff@rcn.com>
Cc:        questions@freebsd.org
Subject:   Re: sh scripting question
Message-ID:  <BA09CF7D-800F-4F0E-825D-C46230FBFE72@rpi.edu>
In-Reply-To: <24456.60388.135834.43951@jerusalem.litteratus.org>
References:  <24456.60388.135834.43951@jerusalem.litteratus.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BA09CF7D-800F-4F0E-825D-C46230FBFE72>