Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Command Line Fundamentals

You're reading from   Command Line Fundamentals Learn to use the Unix command-line tools and Bash shell scripting

Arrow left icon
Product type Paperback
Published in Dec 2018
Publisher
ISBN-13 9781789807769
Length 314 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Vivek Nagarajan Vivek Nagarajan
Author Profile Icon Vivek Nagarajan
Vivek Nagarajan
Arrow right icon
View More author details
Toc

Command Lists

Command lists are a mechanism used to execute multiple independent commands at once, either sequentially or concurrently. Sequentially, they can be used to run each command one after another (simple sequential execution) or run each command depending on the success or failure of the previous one (dependent execution). However, before we understand how command lists work, we need to learn the concept of exit codes.

When any program or command exits, it returns a number, called the exit code, to the shell. This number is zero if the command completes successfully and non-zero otherwise. Exit codes are also sometimes referred to as return values.

Command List Operators

Command lists are formed by stringing together commands with an operator in between, such as the ; operator, & operator, and the && or || operators. Now, let's look at each of these operators in detail.

Semicolon Operator

The ; operator is quite simple and is used to execute...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime