Re: Wanted: quoted param expansion that expands to nothing if no params
From:
Ilkka Virta
Subject:
Re: Wanted: quoted param expansion that expands to nothing if no params
Date:
Wed, 24 Mar 2021 21:49:32 +0200
On Wed, Mar 24, 2021 at 9:38 PM L A Walsh <bash@tlinx.org> wrote:
> Hmmm...Now that I try to show an example, I'm not getting
> the same results. Grrr. Darn Heizenbugs.
>
Just remember that if you test with printf, it always prints at least once,
which makes it look exactly as if it got an empty string argument, even if
there are none:
$ set --
$ printf ":%s:\n" "$@"
::
$ set -- ; printf ":%s:\n" x "$@"
:x: