Basic Shell Scripting: Chapter-VII

Functions in Shell Script: Function is a subscript inside a shell script. We can separate a complex script to multiple task by adding function to it. Just we need to call them where it required. In this article I will show you how to use functions in a shell script. Syntax for Shell function:

[…]
Continue reading…

 

Basic Shell Scripting: Chapter-VI

Case Statement in Shell Script: In shell script case statement is similar to switch statement in C. The case statement allows you to easily check pattern (conditions) and then process a command-line if that condition evaluates to true. Syntax of bash case statement:

Example:

Previous Chapter Next Chapter
Continue reading…

 

Basic Shell Scripting: Chapter-V

Loop in Shell Script: (while, until, for) The while executes a piece of code if the control expression is true, and only stops when it is false. While Statement Example:

The until loop is almost equal to the while loop, except that the code is executed while the control expression evaluates to false. Until […]
Continue reading…

 

Basic Shell Scripting: Chapter-IV

Shell Conditional Statements: (if, elif, else) Usage:

Example 1:

Example 2:

Example 3:

nested if else in bash:

Previous Chapter Next Chapter
Continue reading…

 

Basic Shell Scripting: Chapter-III

Shell Script Variables: Variable in shell script means, referencing a numeric or character value. We can access the value of a variable, prefix it with a dollar sign. eg:

Here the variable name is “value “. We can access it’s value by writing $value. Example 1: Storing character value in a variable

Example […]
Continue reading…