Re: Parameter expansion with extended pattern make system hang
From:
Martin Schulte
Subject:
Re: Parameter expansion with extended pattern make system hang
Date:
Tue, 6 Sep 2022 23:10:45 +0200
Hi!
> > Here's another:
> >
> > printf -- '%s ' $(gcc --help) | sed 's/ $/\n/'
> >
> > Let just do the shell most of the work ;-)
>
> That's not safe. The unquoted substitution will undergo word splitting,
> which we want, and also globbing, which we do *not* want.
>
> You should at least disable globbing first, with set -f.
Sure, thanks!
> I also don't understand why you used a '%s ' format and then changed
> spaces to newlines with a second process. You might as well just use
> a '%s\n' format in the first place, and skip the sed/tr.
I just changed the last one!
Best regards,
Martin