O'Reilly logo

LPIC-1/CompTIA Linux+ Certification All-in-One Exam Guide (Exams LPIC-1/LX0-101 & LX0-102) by Robb Tracy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using Command Substitution and Shell Functions

Let’s end this chapter by discussing the following features of the bash shell environment:

• Using command substitution

• Using shell functions

Using Command Substitution

The bash shell allows you to use command substitution, which allows you to run a command and have its output pasted back on the command line as an argument for another command. Essentially, command substitution allows you to perform multiple tasks at once.

Command substitution works by first creating a child process that runs the first command. The stdout from this command is then piped back to the bash shell. The shell parses the output from the first command into words separated by white space. After the pipe from the first command ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required