Cancel

Input, Output, and Error Redirection in Bash

Input, Output, and Error redirection is the most important topic to cover in Bash Scripting. Standard Output, aka stdout, whose symbolic value is > or >>. # over write data every time yo...

Input from User in Bash

Read command takes the input from a user and saves it onto a variable, so you can use it later on during your script. Ask a user to press Y or N to execute. read is a command to ask user to gi...

Heredoc in Bash

You can run any program within a shell script without user action by supplying the required input for the interactive program. EOF operator stands for the end of the file. This means that wherever...

Functions in Bash

The function is essentially a set of commands that can be called numerous times. The purpose of a function is to help you to make your bash scripts more readable and to avoid writing the same code ...

File Importing in bash

You can import a file in bash using the source command. Create few variables in vars file, so you can use these variables later on inside the different files. first_name="Yafiz" last_name="Abraha...

Execute Multiple Commands at Once in Bash

You can execute multiple commands at once, which helps you to reduce your stress level. Single line commands can be separated by semicolon after each command. echo "run this first"; echo "run thi...

Fatal, Warning, Success, and Info color codes in Bash

Make your bash script messages colorful. I am going to use the xterm-256 color code because it is supported by pretty much all terminals. Foreground Formula Code: 38 Background Formula Code: ...

Dictionary/Objects in Bash

Dictionary is the collection of key and value pair which helps you to improve your productivity. You can create an dictionary/object like the following code, values can be either wrapped with singl...

Conditional Statements in Bash

The statement allows you to make decisions in your Bash scripts. It allows you to run a piece of code based upon conditions and make much more complex scripts, which may solve your larger tasks or ...

Brace Expansion in Bash

Brace expansion is used to generate a series of words or letters separated by , comma, or .. 2 periods. .. 2 periods will set a range from x to x position. , comma will generate a series of s...