[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: printf '%s\n' "$@" versus <<< redirection
From: |
Kerin Millar |
Subject: |
Re: printf '%s\n' "$@" versus <<< redirection |
Date: |
Sun, 19 Feb 2023 10:38:22 +0000 |
On Sun, 19 Feb 2023 10:00:17 +0000
goncholden <goncholden@protonmail.com> wrote:
> while IFS='\n' read -r vl
This does not behave in the way that you think. IFS is used for field
splitting, not to determine where a record ends (that's what the -d option is
for).
$ printf 'n\n' | { IFS='\n' read -r vl; declare -p vl; }
declare -- vl=""
$ printf '\\\n' | { IFS='\n' read -r vl; declare -p vl; }
declare -- vl=""
$'\n' would have expanded as an actual LF character but it would not be useful
to you. To read each line verbatim, set IFS to the empty string instead. Also,
see "help read", the bash manual and https://mywiki.wooledge.org/BashFAQ/001.
--
Kerin Millar
- 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 <=
- 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, 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, 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