How to concat variable and string in bash script

Strings are concatenated by default in the shell.

value="$variable"text"$other_variable"

It’s generally considered good practice to wrap variable expansions in double quotes.

You can also do this:

value="${variable}text${other_variable}"

The curly braces are useful when dealing with a mixture of variable names and strings.

Note that there should be no spaces around the = in an assignment.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)