It’s a best practice to make bash script in a clean and understandable way. You can make you code clean and arrange by indenting, blocks and giving related names of variables and functions. You can also improve the code readability using comments. Comments are human-readable explanation or short description. In this article we will show
Tutorial - Page 11 of 36 - DesignLinux
How to Increment and Decrement Variable in Bash
Variable increment and decrement is fundamental arithmetic operation in bash scripting. It’s mostly used with the for, while and until loops. Increment means adding value to variable and Decrement means subtracting from numeric variable value. This article explains multiple ways to increment or decrement a variable. Use of + and – Operators# You must use
How to Install Flask on Ubuntu 20.04
Flask is a free and open-source micro web framework for Python designed to help developers build secure, scalable, and maintainable web applications. Flask is based on Werkzeug and uses Jinja2 as a template engine. Unlike Django , by default Flask doesn’t include ORM, form validation, or any other functionalities provided by third-party libraries. Flask is
How to Check if a String Contains a Substring in Bash
While you working with string in Bash need to check whether a string contains another string. In this guide, we will show you multiple ways to check if a string contains a substring in bash scripting. Use Wildcards# It is easy to use asterisk wildcard symbols (asterisk) * to compare with the string. Wildcard is
Bash Arrays
Arrays are set of data and fundamental requirement for any programming language. We can say that it’s a variable with multiple child variables. This article shows you basics and use of arrays in Bash scripts. Bash Arrays# One dimensional array with numbered index and associative array types supported in Bash. Those are referenced using integers
who Command in Linux
In this article, we explain the who command that is bundled in GNU coreutils package. who is a command-line utility that prints a list of currently logged in users. It can also show the current run level, time of the last system boot, and more. How to Use the who Command # The basic syntax
How to Install Python 3.9 on Ubuntu 20.04
Python is one of the world’s most popular programming languages. It is a versatile language used to build all kinds of applications, from simple scrips to complex machine learning algorithms. With its simple and easy to learn syntax, Python is a popular choice for beginners and experienced developers. Python 3.9 is the latest major release
How to Read a File Line By Line in Bash
At the time of writing of Bash scripts, sometimes you need to read a file line by line. In this tutorial, we will show you how to read file line by line in Bash. Syntax for Read File Line by Line# The following is the common syntax for reading a file line-by-line: while IFS= read
Bash Heredoc
A Heredoc (Here document) is a redirection type which allows to pass multiline lines of input to a command. Sometimes while writing shell scripts you need to pass multiline block of code or text with the command like cat, sftp or tee. In this guide, you will learn how to use the Heredoc in bash.
How to Install Nvidia Drivers on Ubuntu 20.04
This article describes how to install the NVIDIA drivers on Ubuntu 20.04. If your Ubuntu machine has an NVIDIA GPU, you can choose between the open-source driver Nouveau and NVIDIA’s proprietary drivers. By default, Ubuntu uses Nouveau drivers that are generally much slower than the proprietary drivers and lacks support for the latest hardware and