Input/output redirection in the Bash shell

Data Flow

© Lead Image © xyzproject, 123RF.com

© Lead Image © xyzproject, 123RF.com

Article from Issue 179/2015
Author(s):

The Bash shell lets you string several commands together if the capabilities of a single tool do not meet your needs.

Bash commands are very useful for configuring, managing, troubleshooting, and hundreds of other tasks. The power of the shell, however, really becomes apparent when you learn to chain individual programs and redirect the output.

You can link individual commands together in Bash in just a few steps. Instead of the sequence in the first three lines of Listing 1, you can combine the individual work steps and, using the semicolon, tell the interpreter to run all commands one after another (last line).

You can gain even more control by imposing a condition on Bash – for example, by only letting Bash run a second (or third or nth) command if another command was successful or unsuccessful.

[...]

Use Express-Checkout link below to read the full article (PDF).

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus