bug-textutils
[Top][All Lists]
Advanced

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

Re: multiple inputs / outputs through descriptors


From: Bob Proulx
Subject: Re: multiple inputs / outputs through descriptors
Date: Sun, 31 Aug 2003 17:21:06 -0600
User-agent: Mutt/1.3.28i

address@hidden wrote:
> aside: Do you know whether there is a way to *switch* two
> descriptors (like stdout / stderr) ? I.e. the intuitive
> '( ls -d / /asdfasdf 1>&2 2>&1 ) >err 2>out' doesn't work.

As with the classic variable swap trivia problem in a program you need
a temporary variable to hold the value so that you can swap everything
round robin fashion.  The last part closes the temporary and cleans up.

  ( ls -d / /asdfasdf 3>&2 2>&1 1>&3 3>&- ) >err 2>out

Bob




reply via email to

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