[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: printf '%s\n' "$@" versus <<< redirection
From: |
Greg Wooledge |
Subject: |
Re: printf '%s\n' "$@" versus <<< redirection |
Date: |
Sun, 19 Feb 2023 12:01:20 -0500 |
On Sun, Feb 19, 2023 at 04:07:40PM +0000, Kerin Millar wrote:
> I'll have a go at explaining it. Looking at
> https://pubs.opengroup.org/onlinepubs/9699919799/utilities/read.html, a
> particular behaviour is described for the case where the number of fields
> ends up being greater than the number of specified names, affecting the
> second, fourth and sixth of your test cases.
>
> >
> > unicorn:~$ printf 'n\n' | { IFS='\n' read -r vl; declare -p vl; }
> > declare -- vl=""
>
> There is one "n"-terminated field, matching the number of specified names.
> Its value is "", which is assigned.
Ugh! It's pitfall 47 again.
https://mywiki.wooledge.org/BashPitfalls#pf47
No matter how many times I run into this, I never remember. Because it
MAKES NO SENSE.
- Re: printf '%s\n' "$@" versus <<< redirection, (continued)
- Re: printf '%s\n' "$@" versus <<< redirection, alex xmb ratchev, 2023/02/18
- Re: printf '%s\n' "$@" versus <<< redirection, Kerin Millar, 2023/02/18
- Re: printf '%s\n' "$@" versus <<< redirection, alex xmb ratchev, 2023/02/18
- Re: printf '%s\n' "$@" versus <<< redirection, Mike Jonkmans, 2023/02/18
- Re: printf '%s\n' "$@" versus <<< redirection, Kerin Millar, 2023/02/18
- Re: printf '%s\n' "$@" versus <<< redirection, goncholden, 2023/02/19
- Re: printf '%s\n' "$@" versus <<< redirection, Kerin Millar, 2023/02/19
- Re: printf '%s\n' "$@" versus <<< redirection, Greg Wooledge, 2023/02/19
- Re: printf '%s\n' "$@" versus <<< redirection, Kerin Millar, 2023/02/19
- Re: printf '%s\n' "$@" versus <<< redirection,
Greg Wooledge <=
- Re: printf '%s\n' "$@" versus <<< redirection, Kerin Millar, 2023/02/19
- Re: printf '%s\n' "$@" versus <<< redirection, Greg Wooledge, 2023/02/19
- Re: printf '%s\n' "$@" versus <<< redirection, goncholden, 2023/02/20
- Re: printf '%s\n' "$@" versus <<< redirection, Greg Wooledge, 2023/02/20
- Re: printf '%s\n' "$@" versus <<< redirection, goncholden, 2023/02/20
- Re: printf '%s\n' "$@" versus <<< redirection, Chet Ramey, 2023/02/20
- Re: printf '%s\n' "$@" versus <<< redirection, Mike Jonkmans, 2023/02/20
- Re: printf '%s\n' "$@" versus <<< redirection, Greg Wooledge, 2023/02/20
- Re: printf '%s\n' "$@" versus <<< redirection, Mike Jonkmans, 2023/02/21
- Re: printf '%s\n' "$@" versus <<< redirection, Chet Ramey, 2023/02/21