Re: [dev] Preprocessor

From: Hadrien Lacour <hadrien.lacour_AT_posteo.net>
Date: Tue, 23 Apr 2019 18:23:55 +0200

On Mon, Apr 22, 2019 at 01:35:02PM -0700, Evan Gates wrote:
> On Mon, Apr 22, 2019 at 1:25 PM Adrian Grigore
> <adrian.emil.grigore_AT_gmail.com> wrote:
> >
> > ls -1 "$1" | while IFS= read -r p
> > do
>
> Not sure about the preprocessor stuff, but this right here is terrible
> practice. Use a for loop and glob. Assuming that "$1" is a directory:
>
> for p in "$1"/*; do ...
>
> http://mywiki.wooledge.org/ParsingLs
>

What if "$1" is empty? POSIX sh doesn't have the nullglob shop, you know.
Received on Tue Apr 23 2019 - 18:23:55 CEST

This archive was generated by hypermail 2.3.0 : Tue Apr 23 2019 - 18:36:08 CEST