Bash Articles

Page 2 of 2

How to Parse XML File in Bash Script?

Mead Naji
Mead Naji
Updated on 04-Nov-2024 2K+ Views

XML stands for Extensible Markup Language. It's a widely used format that is used to exchange data between systems. Many applications are based on XML as their configuration files. Even the very well-known document application, Office, is based on XML. What makes XML very popular is that it is written in plain text, which makes it easy to work with and also independent. It can be used in any programming language. Unlike HTML and other markup languages, XML doesn't come with predefined tags that you need to remember and use. With XML, you can use tags of your choice ...

Read More

How to Parse a CSV File in Bash

Mead Naji
Mead Naji
Updated on 04-Nov-2024 434 Views

CSV files are a common file format that we use on the Internet a lot. They are basically a file type that consists of lines, with each line considered a row in a simple table. As the name suggests, CSV (Comma-Separated Values) means that data in each line is separated by commas. CSV files are just plain text that we can view and edit in any editor. The common fields we see using this type of file are in spreadsheets, databases, storing configuration data, and data exchange between APIs. In Linux, there are many ways to parse a file like ...

Read More

Hello World in Bash Script

Mead Naji
Mead Naji
Updated on 04-Nov-2024 437 Views

A command line or terminal is an important component of the Linux operating system, as it allows for inclusive administration and management of the operating system as a whole. Even if we are talking about a Linux distribution that uses a graphical interface, you will still need a terminal to unleash all the power and potential of Linux. Linux provides a "shell" to work on the command line. The shell is a command interpreter responsible for executing commands based on what you enter on the command line. The most popular shell is bash (short for "Bourne Again Shell, " ...

Read More

Bash trap Command Explained

Satish Kumar
Satish Kumar
Updated on 13-Apr-2023 5K+ Views

Bash is a powerful shell used in Linux systems for executing commands and managing processes. trap command in Bash is a useful tool for handling signals and errors that can occur during script execution. In this article, we'll explain what Bash trap command is, how it works, and give some examples of how you can use it. What is Bash Trap Command? The Bash trap command is a mechanism that allows you to handle signals and errors that can occur during script execution. Signals are software interrupts that are sent to a process to notify it of an event, such ...

Read More

Bash wait Command with Examples

Satish Kumar
Satish Kumar
Updated on 12-Apr-2023 10K+ Views

Introduction The Bash shell is one of most widely used shells in Unix/Linux environment. One of its most useful commands is wait command. In this article, we will explore Bash wait command and its usage with examples. What is Bash wait Command? The wait command is a built-in Bash shell command that waits for termination of a background process. This means that Bash shell will pause execution until specified process has completed. Usage of Bash wait Command The basic syntax of wait command is as follows − wait [n] Here, 'n' is process ID of background process that we ...

Read More

Bash String Comparison

Satish Kumar
Satish Kumar
Updated on 12-Apr-2023 4K+ Views

When it comes to programming in Bash, string comparison is a fundamental concept that every developer needs to be familiar with. Bash string comparison involves comparing two strings and evaluating whether they are equal, not equal, greater than, or less than each other. Understanding how to compare strings in Bash is essential for writing reliable and robust scripts. In this article, we'll explore basics of Bash string comparison and provide examples to help you understand concept better. We'll start with an introduction to comparison operators and then move on to different types of string comparison techniques. Comparison Operators Bash provides ...

Read More

Bash Printf - How to Print a Variable in Bash

Satish Kumar
Satish Kumar
Updated on 12-Apr-2023 10K+ Views

Printing variables in Bash is a common task when working with shell scripts. Bash printf command is a powerful tool that allows you to print variables with precision and formatting options. In this article, we will explore how to use Bash printf to print variables in various ways. What is Bash Printf? Bash printf is a command-line utility that is used to format and print text on terminal. It is a built-in command in Bash, which means that it is available in every Bash shell session without need for any external dependencies. The printf command is similar to echo command, ...

Read More

Bash Single vs. Double Quotes What\'s Difference

Satish Kumar
Satish Kumar
Updated on 12-Apr-2023 1K+ Views

If you've spent any time using Bash, you've probably noticed that there are two types of quotes you can use when defining variables or passing arguments to commands: single quotes (' ') and double quotes (" "). At first glance, these quotes might seem interchangeable, but there are actually some key differences between them that can impact behavior of your Bash commands. In this article, we'll explore those differences and explain when you should use single quotes, when you should use double quotes, and what happens when you mix them up. Defining Single and Double Quotes Before we dive into ...

Read More

Bash Script for Loop Explained with Examples

Satish Kumar
Satish Kumar
Updated on 12-Apr-2023 925 Views

If you're a Linux or Unix user, chances are you've used Bash at least once or twice. Bash is a command-line shell that lets you interact with your operating system in a more direct and powerful way than using a graphical user interface. One of most powerful features of Bash is for loop, which lets you automate repetitive tasks by iterating over a list of values. In this article, we'll explore how Bash for loop works and provide some examples of how you can use it in your own scripts. What is a For Loop? A for loop is a ...

Read More

How to Use Command Line Arguments in a Bash Script

Bamdeb Ghosh
Bamdeb Ghosh
Updated on 29-Mar-2023 7K+ Views

Introduction In general, there are many ways to pass input to programming or scripting languages and sometimes there is a need to pass input from the command line instead of input from the code. Like any other programming or scripting language bash scripting also support the command-line argument. In this article, we will try to explore the syntax for command-line arguments and then we will see some examples for command-line arguments and discuss the special variables. Command-line Argument Syntax We already know how to run a bash script in Linux. We can use either bash or sh command and then ...

Read More
Showing 11–20 of 20 articles
« Prev 1 2 Next »
Advertisements