[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: printf '%s\n' "$@" versus <<< redirection
From: |
goncholden |
Subject: |
Re: printf '%s\n' "$@" versus <<< redirection |
Date: |
Sun, 19 Feb 2023 10:00:17 +0000 |
------- Original Message -------
On Sunday, February 19th, 2023 at 6:04 AM, Kerin Millar <kfm@plushkava.net>
wrote:
> On Sat, 18 Feb 2023 18:45:00 +0100
> Mike Jonkmans bashbug@jonkmans.nl wrote:
>
> > On Sat, Feb 18, 2023 at 12:52:05PM +0000, Kerin Millar wrote:
> >
> > > ...
> > > The manual has this to say:-
> > >
> > > "If IFS is unset, or its value is exactly <space><tab><newline>, the
> > > default, then sequences of <space>, <tab>, and <newline> at the beginning
> > > and end of the results of the previous expansions are ignored, and any
> > > sequence of IFS characters not at the beginning or end serves to delimit
> > > words."
> >
> > If IFS is unset then it is slightly ambiguous as to what the IFS characters
> > are,
> > in the last part of this sentence.
>
>
> I agree.
>
> --
> Kerin Millar
Have done as follows for the purpose of readability
theone()
(
for arg in "$@"
do
while IFS='\n' read -r vl
do
printf '## vl: %s ##\n' "$vl"
done <<< "$arg"
done
)
The user would has a number of multiline variables to the function. Then I
would process each line in each variable according to some rules.
var1="
First Argument
Another Line"
var2="
Second Argument
Another Line"
theone "$var1" "$var2"
- 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, goncholden, 2023/02/19
- Re: printf '%s\n' "$@" versus <<< redirection, Kerin Millar, 2023/02/19
- 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, 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 <=
- 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, 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