N
N
niocncn2014-05-15 13:16:22
FreeBSD
niocncn, 2014-05-15 13:16:22

How to do string concatenation in the FreeBSD shell?

There is a file 1.sh, it contains 3 variables

A="test12345"
B="test09876"
C=
echo $C

How to make it so that in C there is something like
test12345_test09876?
The command
C="$A_$B"
does not work, it writes values ​​to C 2 times, first B, then A.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
niocncn, 2014-05-15
@niocncn

All figured out. I opened the file on the server through "ee", and there ^M was added to each line at the end, this was a jamb. Sorry lamer.

K
Konkase, 2014-05-15
@Konkase

C=`echo $A\_$B`

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question