Variables and Assignment

Python Variables and Assignment A variable is a name, which represents a value. To understand it, open a Python terminal and run below command. id = 10 You will not see any result on screen. Then what happens here? This is an assignment statement, where id is a variable and 10 is the value assigned to the variable. A single equal (=) is an assignment operator. Where left side of the operator is the variable and right side operator is a value. Once a value is assigned to the variable,…

Read More

Concatenate string variables

Brief: This example will help you to concatenate two or more strings variable in a bash script. This tutorial helps you with multiple shell script examples of concatenating strings in a shell script. The first example is a general way to concatenate variables of string. You can simply write all the variable one after another:

Output: Welcome TecAdmin! Another Example You can also use += operator to concatenate two strings and store results in the first string.

Output: Welcome TecAdmin! One More Example Use another example with one…

Read More

Bash – Quotes

Quotes in Bash This is a standard practice to quote the string in any programming language. Quotes are used to deal with the texts, filenames with a space character. Read this tutorial to understand the differences between single quote and double quotes. Quote with String While working with simple texts and string, there are no different in using a single quote or double quote.

The above script will run without any error and print the messages and create both directories. Quote with Variables Just remember that the shell variable…

Read More

Bash – Variables

Variables in Bash The bash variables are the same as other programming languages. You don’t need to specify the type of variable in bash scripting. Read below example. #!/bin/bash NAME=”TecAdmin Tutorials” echo $NAME launchdate=”Feb 08, 2013″ echo $launchdate Global vs Local Variables Global variables are accessible anywhere in the script. Where Local variables are accessible in scope only. For example, a variable that is used inside a function only.

System Variables System variables are responsible to define the aspects of the shell. These variables are maintained by bash itself.…

Read More