Linux BASH Scripting

HowTo : Run and Repeat a Command N Times in Bash

In this short note you'll find how to run a command from the Linux command line and repeat it multiple times using loop in Bash.

Mass Emails Sending From Bash Script in Linux

Sending mass emails for testing purposes using Bash Script from the Linux Command Line.

HowTo : Find The Length Of a String or Variable in Bash

This short note shows how to find out the length of a string from the Linux command line, how to count the lengths of each line in a file and how to get the length of a string stored in a variable in Bash and then assign that calculated number of characters to another variable.

"Yes/No" in Bash Script - Prompt for Confirmation

Three simplest ways to prompt for "Yes/No" confirmation in bash script.

Running Commands on a Remote Linux Server over SSH

In this note you will find the examples of how to execute commands on a remote Linux machine and get the result locally.

This information may be very useful if you are creating some Bash Script that should be ran from the local machine and execute some commands on a remote server.

You'll learn, how to :

  • execute a command on a remote Linux Server;
  • run multiply commands over SSH;
  • execute a local script on a remote Linux server without copying it.

CASE Statement in Bash [Example]

The following article describes the basic syntax and includes a simple example of the BASH CASE statement usage.

The CASE statement is the simplest form of the IF-THEN-ELSE statement in BASH.

Print Usage and Exit if Arguments are Not Provided

Use the following test in your shell scripts to :

  • verify a number of input values;
  • display an error message if the number of input argument is not correct;
  • exit a shell script with the error status.