AIX Tip of the Week

AIX Tip of the Week: Simplifying I/O Redirection

Audience: AIX Users

Date: December 8, 2000

One way to capture the results of multiple commands in a file would be:

	cmd1 >  $results
	cmd2 >> $results
	cmdN >> $results

Another way would be to use the Korn shell "grouping" syntax, which we could use to rewrite the above as:

	( cmd1
	) > $results

The grouping technique has several advantages, including less typing, reduced I/O overhead (N file opens vs 1 file open), and less chance of typos such as using a ">" that erases all the accumulated data in the file. About IBM Help Search Feedback

Bruce Spencer,

December 8, 2000