[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [EXT]Re: Suddenly, periods / dots in variable values are converted t
From: |
Greg Wooledge |
Subject: |
Re: [EXT]Re: Suddenly, periods / dots in variable values are converted to space |
Date: |
Mon, 23 Jan 2023 19:44:42 -0500 |
On Mon, Jan 23, 2023 at 05:16:45PM -0700, Chandler wrote:
> Greg Wooledge wrote on 1/23/23 3:08 PM:
> > 1) You forgot to quote.
> > 2) You have somehow managed to set IFS to a value which contains .
> > To fix this:
> > 1) Use quotes when they are needed. less "$File1" will suppress all
> > IFS-based splitting.
> > 2) IFS=$' \t\n' or unset IFS
> I see... I've gotten into some bad habits then, I guess!
> Yes, found some bad code setting IFS=. for some reason, fixed!
> Thank you!
If this is in a script, there might be legitimate reasons to change IFS,
but changes to IFS should be localized as much as possible. Either
localized to a single command, as in:
IFS=. read -ra myarray ...
or in a function:
join() { local IFS="$1"; shift; printf '%s\n' "$*"; }
Usually one of those will do the job, but if for some reason you have
to change IFS in a persistent form in the main body of a script, try to
remember to change it back as soon as possible.
- Suddenly, periods / dots in variable values are converted to space, Chandler, 2023/01/23
- Re: Suddenly, periods / dots in variable values are converted to space, Greg Wooledge, 2023/01/23
- Re: [EXT]Re: Suddenly, periods / dots in variable values are converted to space, Chandler, 2023/01/23
- Re: [EXT]Re: Suddenly, periods / dots in variable values are converted to space,
Greg Wooledge <=
- Re: [EXT]Re: Suddenly, periods / dots in variable values are converted to space, Chandler, 2023/01/23
- Re: [EXT]Re: Suddenly, periods / dots in variable values are converted to space, Kerin Millar, 2023/01/24
- Re: [EXT]Re: Suddenly, periods / dots in variable values are converted to space, Chandler, 2023/01/24
- Re: [EXT]Re: Suddenly, periods / dots in variable values are converted to space, Kerin Millar, 2023/01/25
- Re: [EXT]Re: Suddenly, periods / dots in variable values are converted to space, David, 2023/01/25
- Re: [EXT]Re: Suddenly, periods / dots in variable values are converted to space, Chandler, 2023/01/25
Re: [EXT]Re: Suddenly, periods / dots in variable values are converted to space, Chandler Sobel-Sorenson, 2023/01/23
Re: Suddenly, periods / dots in variable values are converted to space, Lawrence Velázquez, 2023/01/24