[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Not so useless use of cat

From: Bob Proulx
Subject: Re: Not so useless use of cat
Date: Tue, 16 Sep 2014 13:00:54 -0600
User-agent: Mutt/1.5.23 (2014-03-12)

Greg Wooledge wrote:
> 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".

That is one of the reasons I don't like the /dev/std{err,in,out}
things.  They are not portable.  They do different things on different
systems.  I avoid them.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]