Bash is a Unix Shell. Using Bash commands we can write applications for Linux OS.
Bash Script is a file with commands that can be run from Linux Terminal.
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.
- Tutorial – Bash Script Example: Explanation about the basic components of a bash script file
- Tutorial – 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.
- Tutorial – Echo: Basic Bash Command to echo a string or variables to the terminal.
- Tutorial – Variables: Variables are used to store data. The tutorial describes bash variables and local bash variables with syntax, usage, and examples.
- Tutorial – Command Line Arguments: User can pass arguments while running the script file. The tutorial explains how to work with arguments.
- Tutorial – Read User Input: Taking input from the user is an important aspect for any kind of program/application. Learn to prompt the user for input
- Tutorial – Read Username and Password: Learn to read password without echoing back the actual password to a Linux terminal.
- Bash Operators
- Tutorial – 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.
- Tutorial – Bash If Statement: Introduction to conditional statements with if statement. Contains syntax and examples.
- Tutorial – Bash If-Else Statement: Going a step deeper into two-level branching of program control.
- Tutorial – Bash Else-If Statement: Mulitple branching conditions in a single statement.
- Tutorial – Bash Case Statement: Executing a specific set of statements based on the value of a variable or an expression.
- Tutorial – 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.
- Tutorial – Bash While Loop: Repeat a set of statements based on an expression.
- Tutorial – Bash Until Loop: This is a little variation to while loop, but it is handy.
- Tutorial – Bash String Manipulations: Some of the commonly used string operations with examples.
- Tutorial – Bash String Length: Find the length of a given string.
- Tutorial – Bash Strings Equal: To check if given two strings are the same in value or not.
- Tutorial – Bash Split String: Split a string into tokens based on a single character delimiter or another string as a delimiter.
- Tutorial – Bash Sub-String: Get the substring of a string when starting and ending index are given.
- Tutorial – Bash Concatenate Strings: Learn to concatenate two or more strings.
Functions help to wrap a logical piece of a task as a functionality that could be called.
- Tutorial – Bash Functions: A basic introduction to functions in Bash Scripting.
- Tutorial – Bash Override Commands: This is interesting. You can override the built-in commands with your own set of statements.
Arrays are used to store multiple elements in a single container. Elements can be accessed using the index.
- Tutorial – Bash Array: A decent introduction to initialize an array and access elements of it in bash scripting.
Bash File Operations
- Tutorial – Bash Read File: Example bash scripts to read contents of a file.
- Tutorial – Bash Read File Line by Line: Example bash scripts to read contents of a file (like text file) line by line.
- Tutorial – Bash Write to File: Example bash scripts to write data to a file.
- Tutorial – Check if the file exists: Bash script to check if the file exists.
- Tutorial – Check if the file is a directory: Bash script to check if the file is a directory.
- Tutorial – Check if the file is readable: Bash script to check if the file is readable.