Shell Scripting Tutorial: Shell Script Conditional Statements
Shell Scripting Tutorial: Special Operators
In this chapter we shall know about some special operators, which makes shell script powerful while writing and executing the scripts. 4.1. Redirectors 4.2. Pipes 4.3. exit status 4.4. Shell Special Variables 4.5. eval command 4.6. sleep command 4.7. trap command 4.1. Redirectors Usually we give input to the script from standard input [STDIN] and […]
Shell Scripting Tutorial: Shell Script reading from user input and passing arguments to bash script.
To read an input from the user, use the “read” command. The read command will take the input from the user and assigns to a variable. Syntax: read <variable_name> example: read website_name read -p option: If you want to display a help text to the user, then use “-p” option. Example 1: read -p “Enter […]
Shell Scripting Tutorial: Shell Script Variables
In shell script there is no need to declare a variable before using it. A variable is a name given to memory location, which is used to store a value. The value can be accessed by variable name for further manipulation. In this chapter we shall look at below topics: 2.1 How to set a […]
Shell Scripting Tutorial: Introduction to shell script
In this introduction chapter, we shall look at below topics 1.1 Now what is a shell script? 1.2 what are the uses of shell script? 1.3 How to create a shell script? 1.4 Writing your first shell script 1.5 How to execute a script? 1.6 Shell Comments 1.7 The “echo” command 1.8 Colouring the output […]
C++ 11 feature: Initializer Lists and Static Assertions
In this chapter we shall study 2 new concepts of C++. 1. Initializer List 2. Static Assertions 1. Initializer List It is used to initialize data members of a class or to create a container of elements. It can be created using braced list syntax, for example {1, 2, 3}. It will create a sequence […]
C++ 11 feature: Forwarding References
Forwarding Reference is a new feature in C++11. They are also called as Universal References. It means, it will binds to both lvalues and rvalues. We will see in example further below. Forwarding reference uses the syntax “T&&” or “auto&&”. What is the difference between rvalue reference and forward reference ? rvalue reference looks like […]
C++ 11 feature: Parameter Pack and Variadic Templates
Parameter Pack: Parameter pack is the new feature in C++11. “…” is the syntax to create a parameter pack or to expand one . Parameter pack is used to pack multiple parameters into single parameter. This can be done by placing ellipsis “…” to the left of the parameter name. Below example shows how to […]
C++ 11 and 14 feature lambda expression
Lambda function is used for functional programming. In this chapter we shall learn about lambda functions. Lambda expressions are used to define an anonymous function object or closure. In C++ a simple lambda can be defined as below: [] () {} Here [] is the capture list () is the argument list {} is the […]
C++ 11 feature: reinterpret_cast
“reinterpret_cast” has been introduced in C++ 11. This cast should be carefully used. * reinterpret_cast is used to convert one pointer to another pointer of any other type. * It will not check if the pointer and the data pointed by the pointer are same or not. Syntax of reinterpret_cast cast: data_type *var_name = reinterpret_cast […]