From the course: Linux: Shells and Processes
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Command lists and subshells - Linux Tutorial
From the course: Linux: Shells and Processes
Command lists and subshells
- [Instructor] Although Bash has the ability to do loops, conditionals and functions, they can get clumsy outside of a shell script. For interactive shell usage, command lists and command groups can be more useful. A command list is a sequence of one or more commands separated by an operator. The operator can be one of semicolon, double ampersand, or double pipe. The line can be terminated with an ampersand or a new line. If you separate commands with a single semicolon, they will be executed one after another. A command can fail and the next command will still be executed in turn. To see this work, type in CD, space, tilde, /Videos, space, semicolon, space, LS and hit Enter. In this example, I changed into the videos directory, and then list the directory using LS. When any command executes, it stores a numeric exit status in the dollar sign, question mark variable. If that command executes successfully, the exit status…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
Escape characters and quotes5m 44s
-
(Locked)
Brace expansion6m 12s
-
(Locked)
Command and variable substitution7m 14s
-
(Locked)
Command input and output1m 55s
-
(Locked)
Connecting programs with pipes4m 19s
-
(Locked)
File redirects and tees6m 8s
-
(Locked)
Combining pipes, redirects, and tees6m 41s
-
(Locked)
Command lists and subshells7m 53s
-
(Locked)
-
-
-