问题
How can I concat strings in shell? Is it just...
var = 'my';
var .= 'string';
?
回答1:
How about this:
var="${var}string"
回答2:
It depends on the shell, but since question was tagged bash:
var='my'
var=$var'string'
回答3:
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