We can concatenate string variables by using bash in the following two ways:
+=
operator#first wayvar_name = "${string variable name} provide string here"#second wayvariabe_name+="provide string here"
# given stringstr1="Hello"#concatenate using first waystr2="${str1} World"echo $str2#concatenate using second waystr1+=" World"echo $str1
str1
.str2
, and initialize it by concatenating the first way.+=
operator and store it in the same variable.