[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Suddenly, periods / dots in variable values are converted to space
From: |
Lawrence Velázquez |
Subject: |
Re: Suddenly, periods / dots in variable values are converted to space |
Date: |
Tue, 24 Jan 2023 03:34:08 -0500 |
User-agent: |
Cyrus-JMAP/3.9.0-alpha0-85-gd6d859e0cf-fm-20230116.001-gd6d859e0 |
On Mon, Jan 23, 2023, at 4:17 PM, Chandler wrote:
> I know it's safer to use curly braces and I've been doing that more and
> more
As an aside, unquoted ${var} is not really "safer" than unquoted
$var; they both undergo subsequent splitting and globbing. The
braces only affect how the shell determines the parameter name.
>From the man page:
${parameter}
The value of _parameter_ is substituted. The braces
are required when parameter is a positional parameter
with more than one digit, or when _parameter_ is
followed by a character which is not to be interpreted
as part of its name.
Examples:
$ set -- {a..z}
$ echo "${10}" "$10"
j a0
$ foo=1 foobar=2
$ echo "${foo}bar" "$foobar"
1bar 2
So ${var} may relieve you from having to remember how parameter
names are parsed, but it is not a substitute for quoting.
--
vq
- Re: Suddenly, periods / dots in variable values are converted to space, (continued)
- 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, 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, 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 <=