Daily Shaarli
November 26, 2021
One of the most commonly used string operations is concatenation. String concatenation is just a fancy programming word for joining strings together by appending one string to the end of another string.
In this tutorial, we will explain how to concatenate strings in Bash.
Concatenating Strings
The simplest way to concatenate two or more string variables is to write them one after another:
VAR1="Hello,"
VAR2=" World"
VAR3="$VAR1$VAR2"
echo "$VAR3"93.6% of Americans Agree:
“In general, parents have the constitutional right to
make decisions for their children without government interference
unless there is proof of abuse or neglect.” - 2010 Zogby Poll
Children need to be raised and represented by parents who love them, not by disconnected government officials.
If-else statement takes a specific condition and checks whether the condition is truthy or falsy. If the condition is true, then the if statement executes a specific code block. If the condition is false, then the else statement executes a different code block. //
The switch statement is a multiple-choice selection statement. Once you have given the choices and relevant expressions for each choice, It looks through the choices until it finds the choice that matches the expression and executes it. //
Choosing one over the other is not that straightforward. Here are some tips when choosing one over the other;
You can use if-else when:
- The condition result is a boolean.
- The conditions are complex. For example, you have conditions with multiple logical operators.
You can use a switch-case when:
- There are multiple choices for an expression.
- The condition is based on a predefined set of values such as enums, constants, known types. For example, error codes, statuses, states, object types, etc.
The document exists among the papers of Justice Bushrod Washington. It was traced by scanning through hundreds of microfilmed documents. The images used in the story are photographs of the original.
The original purchase agreement for a tract of land that would become the Liberian capital of Monrovia was uncovered by historian C. Patrick Burrowes in August. (Chicago History Museum) //
It was billed as a land of promise — a place where free Black Americans could obtain more political rights and a better quality of life.
Liberia did not receive its name until 1824, but the territory that became its capital city was purchased on Dec. 15, 1821.
Almost exactly 200 years later, a Liberian historian has discovered that original purchase agreement — a document missing since 1835 that sheds light on the acquisition of the only U.S. colony in Africa.
C. Patrick Burrowes, who was born in Liberia and has taught at Penn State Harrisburg and Marshall University, uncovered the handwritten document in August. It details the sale of a tract of West African land that later became Monrovia, the Liberian capital. The selling price was about $300 worth of weapons, rum and other merchandise.
The document’s whereabouts had been unknown for so long, Burrowes said, that there was speculation it had never existed at all. For the historian, finding the purchase agreement has been the most significant discovery of his career, he said. And for historical understanding of Liberia’s origins, this document helps debunk several prevailing myths about the acquisition of territory that became its capital.
“The details of the land transfer have been shrouded in some controversy, so the recent discovery by Dr. Burrowes is timely, especially so close to the 200th anniversary of the event,” said Herbert Brewer, a Morgan State University historian who studies slavery and the African American diaspora.