How to concatenate two strings in Bash
In this tutorial, we are going to learn about how to concatenate two strings in Bash shell.
Concatenation means joining two or more strings together into a single string.
To concatenate the two strings into a single string, we can use use
+= operator in the bash.
Here is an example:
name="bash" name+="shell" echo "$name"
Similarly, we can also use the below syntax to concatenate strings in Bash.
first="bash" last="shell" name="$first$last" echo "$name"
We can also concatenate by adding space between two strings like this: