[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Not so useless use of cat
From: |
Dennis Williamson |
Subject: |
Re: Not so useless use of cat |
Date: |
Fri, 12 Sep 2014 19:08:24 -0500 |
On Sep 12, 2014 6:42 PM, "Ralf Goertz" <me@myprovider.invalid> wrote:
>
> Hi,
>
> Why do I need cat (the second on) here?
>
> $ echo first >file1
> $ echo second >file2
> $ (for i in file[12] ; do cat "$i" > /dev/stdout ; done) | cat > both
>
> $ cat both
> first
> second
>
> ----
>
> If I omit the "| cat" after the loop I get
>
> $ cat both
> second
>
> Even when using ">> both" instead of "> both" only "second" makes it
> into both. Why? I would have thought that using a subshell should be
> enough to protect the both from being overwritten.
>
> Ralf
>
>
Also remove the redirection to stdout and the subshell
for ... done > both
- Not so useless use of cat, Ralf Goertz, 2014/09/12
- Re: Not so useless use of cat,
Dennis Williamson <=
- Re: Not so useless use of cat, Bob Proulx, 2014/09/12
- Re: Not so useless use of cat, Dennis Williamson, 2014/09/12
- Re: Not so useless use of cat, Bob Proulx, 2014/09/13
- Message not available
- Re: Not so useless use of cat, Ralf Goertz, 2014/09/16
- Re: Not so useless use of cat, Bob Proulx, 2014/09/16
- Re: Not so useless use of cat, Greg Wooledge, 2014/09/16
- Re: Not so useless use of cat, Bob Proulx, 2014/09/16
- Re: Not so useless use of cat, Chet Ramey, 2014/09/16
- Re: Not so useless use of cat, Bob Proulx, 2014/09/17
- Message not available
- Re: Not so useless use of cat, Aharon Robbins, 2014/09/17