Create a file named, ‘concat4.sh‘ and add the following code. Now the above was a very basic example, let' take it to the next level. The most simple way to join two or more strings together is to place the strings one after another. If pattern begins with #, it must match at the beginning of the expanded value of parameter. Hi, I'm new to shell programming. I am trying to concatenate 2 variables into a string in Bash. We will use -v option with the variable name and the string we want to add. Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. I used to use $() when I needed to concatenate two variables with an underscore. The string variable can be added in any position of the string data. read -r filename