[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [suggestion] Brace expansion configurability

From: Chet Ramey
Subject: Re: [suggestion] Brace expansion configurability
Date: Mon, 1 May 2017 15:19:33 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.0.1

On 4/30/17 11:23 AM, omasmotorrad wrote:
> Why is it that one cannot change the delimiter for the
> words generated during brace expansion?

Because they are separate words that are expanded individually, not
a single word that undergoes word splitting.  They end up being
separate arguments to, e.g., `echo'.

The words appear to be space-separated here because `echo' separates
its arguments with spaces on output (as it has done since time

> On stackexchange, there too are questions
> regarding this. Personally I’d like to be able to write
> $ IFS=„,“ echo a{b,c,d}
> rather than
> $ echo a{b,c,d} | tr „ „ „,“

If I were going to do it, I'd use a shell function:

        local IFS=','
        echo "$*"

separate_with_commas a{b,c,d}

The general problem you're trying to solve is basically how to turn
multiple words into a single string, so maybe solve that more directly.

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]