Bash

Contents

Bash#

Bash is a shell commonly used in Linux-based operating systems. Mastering Bash allows you to combine results from Linux utilities and create your own, which is a straightforward way to optimize tasks.

Operators#

Operators available in bash are shown in the table above by groups.

Operator Group

Operators

Description

Arithmetic Operators

+, -, *, /, %, **

Perform mathematical calculations.

Comparison Operators

-eq, -ne, -gt, -ge, -lt, -le

Compare values.

Logical Operators

&&, ||, !

Combine multiple conditions.

String Operators

=, !=, -z, -n

Compare and manipulate strings.

File Test Operators

-e, -f, -d, -r, -w, -x

Test file properties.

Redirection Operators

>, >>, <, 2>, 2>>, &>, &>>

Redirect input and output of commands.

Control Operators

;, &&, ||, (), {}

Control execution flow of commands.

Pipeline Operators

|

Pass output of one command as input to another.