concatenateing string variables overwrites them

时间:2015-06-26 10:24:34

标签: linux string bash variables echo

I have a problem to concatenate two string variables. The second variable overwrites the first one.

Script:

subject1=$(grep -E -o "Exit.{0,12}" 123.log)
subject2=$(grep Transferred: 123.log)
completesubject="$subject1 / $subject2"
echo $completesubject

subject1 contains Exit status 0, while subject2 contains Transferred: sent 308464915408, received 11704 bytes, in 14844.1.

Now completesubject results in / Transferred: sent 308464915408, received 11704 bytes, in 14844.1 seconds, but I want it to be Exit status 0 / Transferred: sent 308464915408, received 11704 bytes, in 14844.1 seconds.

What is the problem?

0 个答案:

没有答案