[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Not so useless use of cat
From: |
Greg Wooledge |
Subject: |
Re: Not so useless use of cat |
Date: |
Tue, 16 Sep 2014 08:11:49 -0400 |
User-agent: |
Mutt/1.4.2.3i |
On Tue, Sep 16, 2014 at 09:03:20AM +0200, Ralf Goertz wrote:
> Actually things are more complicated. I do need the /dev/stdout part. I
> obiously don't have the problem with `cat' but with some other program
> $ for i in file[12] ; do program -i "$i" -o /dev/stdout ; done > outfile
It's important to note that the following two cases are *not*
equivalent:
cat "$i" >/dev/stdout
program -i "$i" -o /dev/stdout
In the first case, the /dev/stdout is part of a redirection. On
platforms that do not have a native /dev/stdout in the file system,
Bash handles this *internally* (and it would actually work the way
you expected).
In the second case, /dev/stdout is just a string as far as Bash is
concerned. It is passed verbatim to "program" as an argument. There is
no internal Bash magic happening. You get the underlying operating
system implementation, or you get "no such file or directory".
You can try the process substitution that was suggested earlier, or
you can explicitly make a named pipe and set up a background reader
process.
- Not so useless use of cat, Ralf Goertz, 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/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 <=
- 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
- Re: Not so useless use of cat, Andreas Schwab, 2014/09/17
- Re: Not so useless use of cat, Chet Ramey, 2014/09/17
- Message not available
- Re: Not so useless use of cat, Aharon Robbins, 2014/09/18
- Re: Not so useless use of cat, Chet Ramey, 2014/09/18
- Re: Not so useless use of cat, arnold, 2014/09/18
- Re: Not so useless use of cat, Greg Wooledge, 2014/09/18