Bash Tutorial – Learn Bash Shell Scripting
About Bash
Bash is a Unix Shell. Using Bash commands we can write applications for Linux OS.
Bash Script
Bash Script is a file with commands that can be run from Linux Terminal.
Bash Tutorial
With the help of these Bash Shell Scripting tutorials, we shall learn bash scripting. Little understanding of the Linux file system and terminal commands would be helpful to get started with these tutorials.
Bash Scripting Basics
In these series of basic bash tutorials, we shall introduce you to some of the bash fundamentals.
- Bash – Script example Explanation about the basic components of a bash script file
- Bash – File extension Know about the file extension for a bash script and the syntax required to tell the Operating System that a file is bash script.
- Bash – echo Basic Bash Command to echo a string or variables to the terminal.
- Bash – Variables Variables are used to store data. This tutorial describes bash variables and local bash variables with syntax, usage, and examples.
- Bash – Command line arguments User can pass arguments while running the script file. This tutorial explains how to work with arguments.
- Bash – Read user input Prompt for input and read input from user via terminal.
- Bash – Read username and password Learn to read password without echoing back the actual password to a Linux terminal.
Bash Operators
In the following tutorials we cover different kinds of operators, in detail with examples .
- Bash Operators
- Bash – Arithmetic Operators Examples and usage demonstration of arithmetic operators in bash scripting.
- Bash Relational Operators
- Bash Conditional Operators+
Bash Conditional Statements
Conditional Statements help to branch out the program execution based on the value of an expression. Following are some of the bash tutorials that provide a broad understanding of conditional statements that can be used in bash scripting.
- Bash If Introduction to conditional statements with if statement. Contains syntax and examples.
- Bash If-Else Going a step deeper into two-level branching of program control.
- Bash Else-If Multiple branching conditions in a single statement.
- Bash Case statement Executing a specific set of statements based on the value of a variable or an expression.
Additional
- Bash If AND Use AND logical operator in If statement’s condition to join two or more simple conditions.
- Bash If OR Use OR logical operator in If statement’s condition to join two or more simple conditions.
- Bash If NOT Use NOT logical operator to invert the condition in If statement.
Bash Loops
- Bash For loop For Loop statement helps to execute a set of statements for each member of a data set or a derived data type variable.
- Bash While loop Repeat a set of statements based on an expression.
- Bash Until loop This is a little variation to while loop, but it is handy.
Bash Strings
- Bash String Programs Some of the commonly used string operations with examples.
Bash Functions
Functions help to wrap a logical piece of a task as a functionality that could be called.
- Bash Functions A basic introduction to functions in Bash Scripting.
- Bash Override commands This is interesting. You can override the built-in commands with your own set of statements.
Bash Arrays
Arrays are used to store multiple elements in a single container. Elements can be accessed using the index.
- Bash Array Introduction to initialize an array and access elements of it in bash scripting.
Bash File Operations
- Bash Read File Example bash scripts to read contents of a file.
- Bash Read File Line by Line Example bash scripts to read contents of a file (like text file) line by line.
- Bash – Write to file Example bash scripts to write data to a file.
- Bash – Check if file exists Bash script to check if the file exists.
- Bash – Check if file is a directory Bash script to check if the file is a directory.
- Bash – Check if file is readable Bash script to check if the file is readable.