[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: case $var in $list) issue
From: |
Zachary Santer |
Subject: |
Re: case $var in $list) issue |
Date: |
Fri, 1 Nov 2024 18:44:50 -0400 |
On Fri, Nov 1, 2024 at 3:56 PM Greg Wooledge <greg@wooledge.org> wrote:
>
> echo $x, however, will never be acceptable.
$ var='::eat:drink:be merry::'
$ ( IFS=':'; printf '%%%s\n' ${var} )
%
%
%eat
%drink
%be merry
%
$ var=':eat:drink:be merry:'
$ ( IFS=':'; printf '%%%s\n' ${var} )
%
%eat
%drink
%be merry
$ var='eat:drink:be merry'
$ ( IFS=':'; printf '%%%s\n' ${var} )
%eat
%drink
%be merry
Non-whitespace IFS characters get treated differently, because how
else are you going to specify an empty string? But there's an empty
string before the first colon, but not after the last?
doc/man.1:
> The shell treats each character of IFS as a delimiter, and splits the
> results of the other expansions into words using these characters
> as field terminators.
The Internal Field Separator is a field terminator.
The explanation of the IFS variable in the "Shell Variables" section
of doc/bash.1 told me to look above for the "EXPANSION" section, but
that section was below.
Current devel branch commit, fffa5d0e7c.
- Re: case $var in $list) issue, (continued)
- Re: case $var in $list) issue, Zachary Santer, 2024/11/01
- Re: case $var in $list) issue, #!microsuxx, 2024/11/01
- Re: case $var in $list) issue, #!microsuxx, 2024/11/01
- Re: case $var in $list) issue, Zachary Santer, 2024/11/01
- Re: case $var in $list) issue, #!microsuxx, 2024/11/01
- Re: case $var in $list) issue, Zachary Santer, 2024/11/01
- Re: case $var in $list) issue, #!microsuxx, 2024/11/01
- Re: case $var in $list) issue, #!microsuxx, 2024/11/01
- Re: case $var in $list) issue, Greg Wooledge, 2024/11/01
- Re: case $var in $list) issue, #!microsuxx, 2024/11/01
- Re: case $var in $list) issue,
Zachary Santer <=
- Re: case $var in $list) issue, Greg Wooledge, 2024/11/01
- Re: case $var in $list) issue, Zachary Santer, 2024/11/01
- Re: case $var in $list) issue, Greg Wooledge, 2024/11/01
- Re: case $var in $list) issue, Chet Ramey, 2024/11/02
- Re: case $var in $list) issue, Zachary Santer, 2024/11/01
- Re: case $var in $list) issue, #!microsuxx, 2024/11/01
- Re: case $var in $list) issue, #!microsuxx, 2024/11/01