[sf-lug] curly braces {} in bash/shell: Re: Meeting notes 2.0

Michael Paoli Michael.Paoli at cal.berkeley.edu
Thu Feb 9 16:33:51 PST 2023

On 2023-02-08 15:01, Ronald Barnes wrote:
> Michael Paoli wrote on 08/02/2023 05.21:
>> On 2023-02-07 08:15, aaronco36 wrote:
>>> Got onto the virtual meeting late; maybe a bit before 12Noon(?)
>>> IIRC, Victor was asking questions about ternary operators and the use
>>> of curly brackets {} in bash scripts.
>> So, curly braces {} in POSIX (and bash) shell.
>> Most notably they're used for two different things,
>> though in both cases, one can think of them as a form of grouping.
> The specific list grouping Victor was asking about was the form of:
> touch {file1,file2}
> and asking if there was another way to do that.

Well, what I'd covered,
was mostly use of curly braces{} in POSIX shell.

Starting I believe with Korn(ksh) shell, and included in at least many
shells through Bash(bash), yes, they add additional use(s) of curly
braces {}, which aren't POSIX ... but can be very handy.  Most of the
time I won't use that in many of the shell programs I write (often
sticking to POSIX), but ... certainly for interactive CLI use, I'll
certainly use/leverage it.

In the ksh(1) man pages, may find that under/around the mentions of
in the bash(1) man pages, may find that around/under the mentions of
Brace Expansion.

More information about the sf-lug mailing list