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

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…

Contents