Concatenating variables in Bash [duplicate]
问题 This question already has answers here : How to concatenate string variables in Bash (30 answers) Closed last year . stupid question no doubt, I'm trying to add a variable to the middle of a variable, so for instance in PHP i would do this: $mystring = $arg1 . '12' . $arg2 . 'endoffile'; so the output might be 20121201endoffile , how can I achieve the same in a linux bash script? 回答1: Try doing this, there's no special character to concatenate in bash : mystring="${arg1}12${arg2}endoffile"