Applies to: Bash 4 and later on Linux (examples tested with Bash 5.1)
In Bash you join strings simply by writing them next to each other. There is no special operator. These are the patterns you need, all tested in Bash 5.1.
Put variables side by side
first="Ucartz"; second="Online" full="$first $second" echo "$full" # Ucartz Online
Use braces when text follows a variable
echo "${first}_${second}" # Ucartz_Online
echo "$firstsuffix" # empty: Bash looks for a variable called firstsuffix
echo "${first}suffix" # Ucartzsuffix
Without braces, Bash reads as many letters, digits and underscores as it can as the variable name. Braces end the name.
Append with +=
path="/var/www" path+="/html" echo "$path" # /var/www/html
Numbers and text
n=5 msg="Items: $n" echo "$msg" # Items: 5
Formatted strings with printf
printf -v line "%s-%03d" "$first" 7 echo "$line" # Ucartz-007
printf -v writes the result into a variable instead of printing it: useful for padded numbers, dates in file names and fixed-width output.
Join the elements of an array
parts=(a b c)
joined=$(IFS=,; echo "${parts[*]}")
echo "$joined" # a,b,c
"${parts[*]}" joins with the first character of IFS; the subshell keeps the change of IFS from affecting the rest of the script.
Build a file name
backup="/backup/site-$(date +%F).tar.gz" echo "$backup" # for example /backup/site-2026-09-29.tar.gz
Common mistakes
full = "$first$second"fails: no spaces around=in Bash assignments.- Unquoted variables with spaces are split into several words; keep the quotes:
"$full".
More: Bash arrays and Bash functions.