Subject: Re: cat(1) question: multiple "-"s
To: Simon Burge <simonb@wasabisystems.com>
From: Hubert Feyrer <hubert@feyrer.de>
List: netbsd-users
Date: 04/19/2006 09:46:28
On Wed, 19 Apr 2006, Simon Burge wrote:
> SUSv3 talks about this a little, saying that it really only makes sense
> for when standard input is a terminal:
>
> The command:
>
> cat start - middle - end > file
>
> when standard input is a terminal, gets two arbitrary pieces of
> input from the terminal with a single invocation of cat. Note,
> however, that if standard input is a regular file, this would be
> equivalent to the command:
>
> cat start - middle /dev/null end > file
>
> because the entire contents of the file would be consumed by cat
> the first time '-' was used as a file operand and an end-of-file
> condition would be detected immediately when '-' was referenced the
> second time.
OK - i guess that's the same for pipes as for files then.
Thanks!
- Hubert