help-bash
[Top][All Lists]
Advanced

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

Re: [Help-bash] What is going on here? Line with multiple < redirects


From: Greg Wooledge
Subject: Re: [Help-bash] What is going on here? Line with multiple < redirects
Date: Fri, 18 Dec 2015 11:36:32 -0500
User-agent: Mutt/1.4.2.3i

On Fri, Dec 18, 2015 at 10:27:49AM -0500, David Niklas wrote:
> % cat < aa < bb < cc
> cc

Redirections are processed from left to right.  Each one is separate.

First, the redirection < aa is processed.  This opens file aa as stdin,
closing whatever the previous stdin was.

Then, the redirection < bb is processed.  This opens file bb as stdin,
closing the previous stdin.

Then, the redirection < cc is processed.  This opens file cc as stdin,
closing the previous stdin.

The result is effectively the same as if you had done   cat < cc
except that the files aa and bb are briefly opened and closed, and
you'll get an error if one of those can't be opened.



reply via email to

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