This question already has an answer here:
- How to concatenate string variables in Bash 30 answers
How can I concat strings in shell? Is it just...
var = 'my';
var .= 'string';
?
How about this:
var="${var}string"
dldnh
It depends on the shell, but since question was tagged bash:
var='my'
var=$var'string'
No. For various reasons.
# most sh-compatible shells
var="my"
var="$var string"
# advanced shells
var="my"
var+=" string"
来源:https://stackoverflow.com/questions/9445259/concat-strings-in-a-shell-script