[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] group
From: |
John McKown |
Subject: |
Re: [Help-bash] group |
Date: |
Mon, 12 Dec 2016 10:07:59 -0600 |
On Mon, Dec 12, 2016 at 9:22 AM, Greg Wooledge <address@hidden> wrote:
> On Mon, Dec 12, 2016 at 08:08:28AM -0600, John McKown wrote:
> > But with BASH, you can use process substitution:
> >
> > some-program <(cat Region{,-*}.csv???)
>
> For the record, note that you need a relatively new version of bash to
> use a brace expansion inside a process substitution.
>
Thanks, I hadn't realized that. I tend to stay very current on Fedora.
>
> imadev:~$ bash-3.2 -c 'echo <(x {y,z})'
> /var/tmp//sh-np-1481557898 /var/tmp//sh-np-3906145805
> imadev:~$ bash-4.0 -c 'echo <(x {y,z})'
> /var/tmp//sh-np-1481549372
>
> In 3.2 and older, <(x {y,z}) was parsed in such a way that the brace
> expansion happened FIRST, and was therefore equivalent to
>
> <(x y) <(x z)
>
> This was changed in bash 4.0.
>
> Personally I never use brace expansions in a script. I might VERY
> occasionally use one in an interactive shell.
>
>
I am also very conservative in an actual script. Which is why I use
#!/bin/sh as my "magic" line instead of #!/bin/bash. If I understand the
doc correctly, that makes BASH run more like a general Bourne shell.
That's more portable.
--
Heisenberg may have been here.
http://xkcd.com/1770/
Maranatha! <><
John McKown