≡ Menu

Bash

5 Bash Case Statement Examples

Bash shell case statement is similar to switch statement in C. It can be used to test simple values like integers and characters. Case statement is not a loop, it doesn’t execute a block of code for n number of times. Instead, bash shell checks the condition, and controls the flow of the program. In [...]

{ 12 comments }

Looping statements are used to force a program to repeatedly execute a statement. The executed statement is called the loop body. Loops execute until the value of a controlling expression is 0. The controlling expression may be any scalar data type. The shell language also provide several iteration or looping statements. In this article let [...]

{ 10 comments }

Bash expression is the combination of operators, features, or values used to form a bash conditional statement. Conditional expression could be binary or unary expression which involves numeric, string or any commands whose return status is zero when success. There are several conditional expressions that could be used to test with the files. Following are [...]

{ 7 comments }

Bash conditional statements perform different computations or actions depending on whether a programmer-specified boolean condition evaluates to true or false. These statements are used to execute different parts of your shell program depending on whether certain conditions are true. The ability to branch makes shell scripts powerful. In Bash, we have the following conditional statements: [...]

{ 20 comments }

The Bash shell provides some variables that are prefixed with ‘~’ (named tilde) which is called Tilde Expansions. They are synonyms for contents of other variables within your shell. Tilde expansion is the process of converting these abbreviations to the directory names that they stand for. In this article, let us review the tilde expansion [...]

{ 7 comments }

Bash Shell expansion One of the operation of the shell when it analyzes the input is Shell expansion. Bash provides different types of expansion. In this article let us review an important expansion — “Brace expansion”. This article is part of our on-going Bash Tutorial series. Brace Expansion Brace expansion is used to generate arbitrary [...]

{ 6 comments }

An array is a variable containing multiple values may be of same type or of different type.  There is no maximum limit to the size of an array, nor any requirement that member variables be indexed or assigned contiguously. Array index starts with zero. In this article, let us review 15 various array operations in [...]

{ 63 comments }

As part of our on-going bash tutorial series, we discussed about bash positional parameters in our previous article. In this article let us discuss about the bash special parameters with few practical shell script examples. Some of the bash special parameters that we will discuss in this article are: $*, $@, $#, $$, $!, $?, [...]

{ 7 comments }